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.
1. Show what’s for sale
Section titled “1. Show what’s for sale”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.
2. Check the promo code
Section titled “2. Check the promo code”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.
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 } ]}'// In the browser. The publishable key is safe in your page.const SABIWAVE_PUBLISHABLE_KEY = 'pk_live_…';
const res = await fetch('https://api.sabiwave.com/api/v1/public/promotions/validate', { method: 'POST', headers: { 'X-Sabiwave-Public-Key': SABIWAVE_PUBLISHABLE_KEY, 'Content-Type': 'application/json', }, body: JSON.stringify({ "code": "WEEKEND10", "items": [ { "productId": "01a2160c-6b00-7627-af42-d534badeaea4", "quantity": 2 } ] }),});const result = await res.json();{ "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:
{ "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.
3. Take the payment, or don’t
Section titled “3. Take the payment, or don’t”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 inpaymentReference, and how they paid inpaymentMethod(bank_transfer,card,mobile_moneyorother). Sabiwave records the order as paid in full, and sendspayment.recordedfor it as well asorder.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.
4. Place the order
Section titled “4. Place the order”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.
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"}'const res = await fetch('https://api.sabiwave.com/api/v1/public/orders', { method: 'POST', headers: { Authorization: `Bearer ${process.env.SABIWAVE_SECRET_KEY}`, 'Idempotency-Key': 'order-9c145175-b450-4d66-8946-3b972543ffed', 'Content-Type': 'application/json', }, body: JSON.stringify({ "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" }),});const result = await res.json();{ "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:
deliveryMethodisdeliveryorpickup(left out, it’sdeliverywhen you senddelivery.address, otherwisepickup).delivery.address(or else the customer’saddress),recipientName,recipientPhoneandnotedescribe it. If you charge for delivery, send the amount indeliveryFeeand Sabiwave adds it to the order. - Promotions: your automatic discounts apply on their own, and so does
promoCodeif 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 withSTOCK_BELOW_ZERO, as a website can’t confirm; with Allow it the order goes ahead.
Every field: Orders.
5. Wait for the order
Section titled “5. Wait for the order”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:
{ "success": true, "data": { "status": "processing" }}then completed, with the order:
curl "https://api.sabiwave.com/api/v1/public/orders/01a22953-ae27-7590-abe0-609936b06d7c/status" \ -H "Authorization: Bearer $SABIWAVE_SECRET_KEY"const res = await fetch('https://api.sabiwave.com/api/v1/public/orders/01a22953-ae27-7590-abe0-609936b06d7c/status', { headers: { Authorization: `Bearer ${process.env.SABIWAVE_SECRET_KEY}`, },});const result = await res.json();{ "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:
{ "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 } ] } }}6. After the order
Section titled “6. After the order”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.
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."}'const res = await fetch('https://api.sabiwave.com/api/v1/public/orders/01a22953-ae27-7590-abe0-609936b06d7c/cancel', { method: 'POST', headers: { Authorization: `Bearer ${process.env.SABIWAVE_SECRET_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "reason": "The customer cancelled on the website." }),});const result = await res.json();{ "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" } }}