Create Order
POST
Creates a new order for a customer. If the order total is greater than zero, a checkout link is returned for payment. If the order is free, it is completed immediately.
/ordersAuthentication
Headers
| Header | Value | Required |
|---|---|---|
Authorization | Bearer YOUR_API_TOKEN | Yes |
Content-Type | application/json | Yes |
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
customer | object | No | Customer identification. Provide either customer.id to reference an existing customer, OR the full customer details below to create/find a customer. |
customer.id | integer | No | Existing customer ID (use this OR the fields below) |
customer.country_code | string | Conditional | Required if customer.id is not provided. One of: 966, 973, 971, 974, 968, 965 |
customer.phone | string | Conditional | Required if customer.id is not provided |
customer.firstName | string | Conditional | Required if customer.id is not provided |
customer.lastName | string | Conditional | Required if customer.id is not provided |
customer.email | string | Conditional | Required if customer.id is not provided |
created_from | string | Yes | Domain name where the order originates (e.g., myapp.com) |
products | array | Yes | Array of products to order (min: 1) |
products[].identifier_type | string | Yes | Either id or slug |
products[].identifier | string/integer | Yes | Product ID or slug |
products[].quantity | integer | Yes | Quantity (min: 1) |
products[].options | object | No | Product field/option selections |
products[].notice | string | No | Customer note for this item (max: 800 chars) |
products[].subscription_plan | integer | No | Subscription variant ID (for subscription products) |
coupon_code | string | No | Coupon code to apply |
Example Request — Existing Customer
Example Request — New Customer
Success Response — Paid Order
HTTP 201 Createdcheckout_url to complete payment.
Success Response — Free Order
HTTP 201 CreatedIdempotency
Duplicate requests within 5 minutes return the existing checkout or order instead of creating a new one. The response includes"duplicate": true:
Error Responses
| Code | Description |
|---|---|
400 | Business logic error (product not found, out of stock, invalid coupon, etc.) |
401 | Unauthorized — invalid or missing token |
422 | Validation error — missing or invalid fields |
Common Error Messages
| Message | Cause |
|---|---|
Product not found: {identifier} | Product ID or slug does not exist in your store |
Product unavailable: {name} | Product is disabled (status 3) |
Requested quantity not available for product: {name} | Insufficient stock |
Minimum quantity is {n} for product: {name} | Below the minimum order quantity |
Maximum quantity allowed for subscriptions is 1 | Subscription products cannot have quantity > 1 |
Invalid coupon code | Coupon does not exist or is disabled |
Coupon is no longer valid | Coupon has reached its maximum usage |
Failed to create or find customer | Customer ID not found in your store |

