Skip to content

Take orders on your website

This is the checkout most websites need. The browser shows products and checks promo codes with the publishable key; your server places the order with the secret key and hears back by webhook.

GET /catalog/products lists the products you’ve turned on Show on your website, with their prices and whether they’re in stock. Read it from your server and keep a copy for a short while, or call it from the browser with the publishable key. The product.updated and inventory.out_of_stock webhooks tell you when your copy is out of date. Details: Catalogue.

When a shopper types a code, ask Sabiwave what it’s worth for their basket. This is safe from the browser with the publishable key, and nothing is reserved: call it as often as the basket changes.

Terminal window
curl -X POST "https://api.sabiwave.com/api/v1/public/promotions/validate" \
-H "X-Sabiwave-Public-Key: $SABIWAVE_PUBLISHABLE_KEY" \
-H "Origin: https://shop.example.com" \
-H "Content-Type: application/json" \
-d '{
"code": "WEEKEND10",
"items": [
{
"productId": "01a2160c-6b00-7627-af42-d534badeaea4",
"quantity": 2
}
]
}'
200 OK
{
"success": true,
"data": {
"valid": true,
"code": {
"code": "WEEKEND10",
"description": null,
"discountType": "percentage",
"value": 10
},
"reason": null,
"message": null,
"discountAmount": 4000,
"automatic": [],
"totalDiscount": 4000,
"subtotal": 40000,
"customerChecked": false
}
}

A code that can’t be used comes back with valid: false, a stable reason and a message you can show as it is:

200 OK
{
"success": true,
"data": {
"valid": false,
"code": null,
"reason": "PROMO_NOT_FOUND",
"message": "That code isn’t valid.",
"discountAmount": 0,
"automatic": [],
"totalDiscount": 0,
"subtotal": 40000,
"customerChecked": false
}
}

Rules about one customer (a code they’ve used before, or one for a first order only) can’t be checked for a guest. They’re checked when the order is made, or now if your server sends the customer’s customerId with the secret key. Details: Promotions.

Sabiwave doesn’t take payment for orders placed through the API. Either:

  • Take it on your website, with your own payment provider, then place the order with paymentStatus: "paid", the provider’s reference in paymentReference, and how they paid in paymentMethod (bank_transfer, card, mobile_money or other). Sabiwave records the order as paid in full, and sends payment.recorded for it as well as order.created.
  • Take it later, for example on delivery, and place the order with paymentStatus: "pending" (the default). Your team records the payment in Sabiwave when it comes in.

Your server sends the customer, the products and quantities, and how it reaches them. Never send prices: every price, discount and total comes from Sabiwave. Send a new Idempotency-Key with each order, and the same key if you retry it: a retry after a timeout then returns the first answer instead of placing a second order.

Terminal window
curl -X POST "https://api.sabiwave.com/api/v1/public/orders" \
-H "Authorization: Bearer $SABIWAVE_SECRET_KEY" \
-H "Idempotency-Key: order-9c145175-b450-4d66-8946-3b972543ffed" \
-H "Content-Type: application/json" \
-d '{
"customer": {
"name": "Kemi Okafor",
"phone": "+2348030000002",
"email": "kemi@example.com"
},
"items": [
{
"productId": "01a2160c-6b00-7627-af42-d534badeaea4",
"quantity": 4
}
],
"deliveryMethod": "delivery",
"delivery": {
"address": "12 Admiralty Way, Lekki, Lagos",
"recipientName": "Kemi Okafor",
"recipientPhone": "+2348030000002",
"note": "Call on arrival"
},
"deliveryFee": 2500,
"promoCode": "WEEKEND10",
"paymentStatus": "pending",
"notes": "Website order #1001"
}'
202 Accepted
{
"success": true,
"message": "Order received: poll its status, or wait for the order.created webhook.",
"data": {
"id": "01a22953-ae27-7590-abe0-609936b06d7c",
"status": "queued"
}
}

With a live key the answer is 202 Accepted: the order has an id, and Sabiwave makes it in the background through the same pipeline as a sale at the POS.

  • The customer is found by phone, then email, the same way as at the POS, or added if new. Send at least one of the two.
  • Delivery: deliveryMethod is delivery or pickup (left out, it’s delivery when you send delivery.address, otherwise pickup). delivery.address (or else the customer’s address), recipientName, recipientPhone and note describe it. If you charge for delivery, send the amount in deliveryFee and Sabiwave adds it to the order.
  • Promotions: your automatic discounts apply on their own, and so does promoCode if you send one. A code that can’t be used fails the order with its reason.
  • Stock: website orders sell from your first open store, the stock the catalogue shows, under your selling rules (Settings › Stores). When there isn’t enough: with Stop the sale the order fails with INSUFFICIENT_STOCK; with Ask, then allow it fails with STOCK_BELOW_ZERO, as a website can’t confirm; with Allow it the order goes ahead.

Every field: Orders.

Either listen for the order.created webhook, or ask GET /orders/{id}/status every second or two. It answers queued or processing while Sabiwave works:

200 OK
{
"success": true,
"data": {
"status": "processing"
}
}

then completed, with the order:

Terminal window
curl "https://api.sabiwave.com/api/v1/public/orders/01a22953-ae27-7590-abe0-609936b06d7c/status" \
-H "Authorization: Bearer $SABIWAVE_SECRET_KEY"
200 OK
{
"success": true,
"data": {
"status": "completed",
"order": {
"id": "01a22953-ae27-7590-abe0-609936b06d7c",
"orderNumber": "PDSWT-20261129-0008",
"status": "pending",
"paymentStatus": "unpaid",
"channel": "website",
"customer": {
"id": "01a22953-aada-745d-a986-131fbe5367bd",
"name": "Kemi Okafor",
"phone": "+2348030000002",
"email": "kemi@example.com"
},
"items": [
{
"productId": "01a2160c-6b00-7627-af42-d534badeaea4",
"name": "Weekend Gift Hamper",
"variant": null,
"quantity": 4,
"unitPrice": 20000,
"discount": 8000,
"total": 72000
}
],
"subtotal": 80000,
"discount": 8000,
"deliveryFee": 2500,
"tax": 0,
"total": 74500,
"amountPaid": 0,
"promotions": [
{
"kind": "code",
"name": "WEEKEND10",
"amount": 8000
}
],
"deliveryAddress": "12 Admiralty Way, Lekki, Lagos",
"createdAt": "2026-11-29T22:01:19.684Z"
}
}
}

or failed, with the reason the order couldn’t be made. Nothing was saved, so you can fix it and place the order again with a new Idempotency-Key:

200 OK
{
"success": true,
"data": {
"status": "failed",
"error": {
"code": "INSUFFICIENT_STOCK",
"message": "Not enough \"Weekend Gift Hamper\" at Main store: 4 available, 500 needed.",
"statusCode": 409,
"details": [
{
"productId": "01a2160c-6b00-7627-af42-d534badeaea4",
"variantId": null,
"storeId": "01a21564-0fa5-73bd-b689-d7a0a4173117",
"name": "Weekend Gift Hamper",
"available": 4,
"needed": 500
}
]
}
}
}

Your team moves the order along in Sabiwave. Your server hears about each step by webhook:

Webhook When
order.status_changed The order moves along, such as pending to confirmed
order.updated Its items are changed in Sabiwave
payment.recorded A payment is recorded on it: the one taken with an order placed as paid (withOrder: true), and any recorded later in Sabiwave or at the POS
order.cancelled It’s cancelled, in Sabiwave or through the API

Your website can cancel an order with no money on it, until it’s delivered, with POST /orders/{id}/cancel. Its stock goes back and any promo code it used can be used again.

Terminal window
curl -X POST "https://api.sabiwave.com/api/v1/public/orders/01a22953-ae27-7590-abe0-609936b06d7c/cancel" \
-H "Authorization: Bearer $SABIWAVE_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"reason": "The customer cancelled on the website."
}'
200 OK
{
"success": true,
"message": "Order cancelled: its stock is back.",
"data": {
"order": {
"id": "01a22953-ae27-7590-abe0-609936b06d7c",
"orderNumber": "PDSWT-20261129-0008",
"status": "cancelled",
"paymentStatus": "unpaid",
"channel": "website",
"customer": {
"id": "01a22953-aada-745d-a986-131fbe5367bd",
"name": "Kemi Okafor",
"phone": "+2348030000002",
"email": "kemi@example.com"
},
"items": [
{
"productId": "01a2160c-6b00-7627-af42-d534badeaea4",
"name": "Weekend Gift Hamper",
"variant": null,
"quantity": 4,
"unitPrice": 20000,
"discount": 8000,
"total": 72000
}
],
"subtotal": 80000,
"discount": 8000,
"deliveryFee": 2500,
"tax": 0,
"total": 74500,
"amountPaid": 0,
"promotions": [],
"deliveryAddress": "12 Admiralty Way, Lekki, Lagos",
"createdAt": "2026-11-29T22:01:19.684Z"
}
}
}