BusinessPlus Connect (Developer)
Cart Architecture & Order Creation API
Implement secure headless cart workflows and submit customer orders programmatically with database-level price recalculation and idempotency protection.
Headless Cart Architecture
When developing a custom headless storefront, manage your shopping cart state responsibly:
- 1. Client Presentation Cart: Your custom frontend may store presentation cart state in React context, Zustand, Pinia, or browser localStorage. This state typically contains product_id, slug, name, thumbnail image, quantity, and the cached display price for user interface responsiveness.
- 2. The Client Cart Is NOT Authoritative: Never rely on client-side calculations as financial authority. Shoppers can manipulate client-side variables or browse with stale tab data. When checking out, your frontend submits only product IDs and requested quantities.
- 3. Server-Authoritative Price Recalculation: Upon receiving an order request, BusinessPlus executes an atomic database transaction that locks active catalog rows, verifies availability, validates stock limits, checks commerce modes, and recalculates authoritative item totals from active records.
Endpoint & Authentication
POST /v1/orders is a SERVER-SIDE ONLY endpoint. It must be called exclusively from your backend server or Next.js Route Handler using your private Site API Key.
Order Request Fields Specification
Validate all fields on your backend server before calling the BusinessPlus Orders API:
NOTE: Note on return_url: POST /v1/orders does NOT consume return_url in the request body. Return URLs are configured by appending ?return_url= to the returned payment.payment_url.
Idempotency Protection (order_request_id)
Idempotency guarantees that replaying a request due to network interruptions, client timeouts, or multiple button clicks will NEVER charge a customer twice or create duplicate orders.
- 1. Generate Once Per Checkout Attempt: Generate order_request_id via crypto.randomUUID() when the customer clicks "Place Order".
- 2. Preserve on Retries: If a network request times out or returns a 5xx error, retry the request using the EXACT SAME order_request_id.
- 3. Safe Replay Behavior: When BusinessPlus receives a known order_request_id for that site, it does not create a new order or trigger duplicate notifications. Instead, it returns the existing order record with "idempotent_replay": true and HTTP 200.
Payment Status vs Fulfillment Status
Developers must distinguish financial status from order fulfillment status:
NOTE: Order creation does NOT mean payment has completed. Newly created orders legitimately have payment_status = "unpaid". Payment is settled when the customer completes checkout on the hosted payment page.
Machine-Readable Error Codes
BusinessPlus returns standard HTTP status codes accompanied by structured machine-readable error codes: