Create an order
From an external basket to the full-amount ERP invoice: lines, delivery, payment, total check.
POST /orders turns an external system’s basket into a store order — then posts it to the ERP through the same gateway as the native storefront: ERP customer found by email (created if missing), sales document for the full amount paid by the customer, stock according to the store’s policy, payment recorded and matched when it took place.
The request
POST/orders
# One key per operation, reused as is on every retry.
curl -X POST 'https://quosuite.com/api/public/v1/quoshop/orders' \
-H "Authorization: Bearer $QUOSHOP_API_KEY" \
-H 'Idempotency-Key: 3f1c2a9e-5b7d-4e8a-9c1f-2d6b8e4a7c30' \
-H 'Content-Type: application/json' \
-d '{
"externalId": "10293",
"source": "woocommerce",
"customer": {
"email": "client@example.com",
"name": "Sarra Ben Ali",
"phone": "+216 20 000 000"
},
"lines": [
{
"sku": "ART-0042",
"quantity": 2
},
{
"productId": "bbbbbbbb-0000-4000-8000-000000000001",
"quantity": 1
}
],
"shippingAddress": {
"fullName": "Sarra Ben Ali",
"line1": "12 rue de la Liberté",
"postalCode": "1000",
"city": "Tunis",
"country": "TN"
},
"delivery": {
"label": "Colissimo",
"amount": 8.33
},
"payment": {
"status": "PAID",
"method": "CARD",
"reference": "pi_3QxYz",
"amount": 365.33
},
"expectedTotal": 365.33,
"notifyCustomer": false
}'| Field | Rule |
|---|---|
externalId + source | the order in your system, and its namespace (woocommerce, prestashop, b2b-site…): the idempotency key, guaranteed by the database — see Guarantee idempotency |
customer.email | required: the ERP customer is found by it, without duplicates. customer.id (an account from /customers) is required when the store refuses guest orders |
lines | productId or sku, and quantity. No price: prices come from the published catalogue at order time, promotions included |
delivery | one of the store’s methods (methodId, fee computed by the store — GET /delivery-options) or your CMS’s transport (label + amount incl. tax) |
payment | PAID (with a unique reference, the transaction id) or PENDING (cash on delivery, transfer expected) |
expectedTotal | the total incl. tax your CMS charged. Never invoiced: a difference above one cent gets the order refused (409) |
postToErp | true by default; false: the order waits for a confirmation (POST …/status) |
notifyCustomer | false by default: your CMS already informs its customers |
The response
201, and the header Idempotent-Replayed: false:
{
"success": true,
"data": {
"id": "0d5c…", "number": "WEB-2026-000042", "channel": "API",
"externalSource": "woocommerce", "externalId": "10293",
"status": "CONFIRMED", "paymentStatus": "PAID",
"totals": { "items": 357, "shipping": 8.33, "total": 365.33, "paid": 365.33, "due": 0 },
"erp": {
"posted": true,
"salesDocument": { "type": "FACTURE", "typeLabel": "Invoice", "number": "FAC-2026-00042" },
"invoiceNumber": "FAC-2026-00042",
"stockApplied": true,
"lastError": null
}
}
}Keep id and number with your CMS order, and show erp.invoiceNumber to the administrator: it is the ERP document.
What can happen
| Response | Meaning | What to do |
|---|---|---|
201, Idempotent-Replayed: true | this order already existed (same source + externalId, same content) | nothing: it is a success, no second order nor invoice |
201, erp.posted: false | the order is created but not posted to the ERP (erp.lastError: missing warehouse, stock-out…) | send the same order again later: the replay completes the posting |
409 CONFLICT + detail.orderId | the reference designates another order (different content) | create nothing; have it checked |
409 CONFLICT without detail | insufficient stock, or total ≠ expectedTotal | report to the administrator |
| 422 | unknown or unpublished product, unknown delivery method | fix the data |
| 401 | key revoked or expired | pause, keep the order queued |
| 429, 5xx, network | transient | retry with the same body and the same Idempotency-Key |
The ERP customer
The gateway finds the ERP customer record by email; failing that, it creates it (“Online store”). To manage buyer accounts explicitly — a store refusing guest orders, a customer base sync — POST /customers creates an account deduplicated by email (an existing account is returned as is, Idempotent-Replayed: true).
POST/customers
# One key per operation, reused as is on every retry.
curl -X POST 'https://quosuite.com/api/public/v1/quoshop/customers' \
-H "Authorization: Bearer $QUOSHOP_API_KEY" \
-H 'Idempotency-Key: 3f1c2a9e-5b7d-4e8a-9c1f-2d6b8e4a7c30' \
-H 'Content-Type: application/json' \
-d '{
"email": "client@example.com",
"firstName": "Sarra",
"lastName": "Ben Ali",
"acceptsMarketing": false,
"locale": "en"
}'