Orders
Order lifecycle
From the moment you send it, an order moves through a small, fixed set of statuses. Each change triggers a webhook.
The usual path. Along the way an order can also become failed, cancelled or returned.
Statuses
| Status | What it means | Webhook |
|---|---|---|
assigned | Accepted and given to an agent. It hasn’t left yet. It is also sent again if the order moves to a different agent. | order.assigned |
out_for_delivery | The agent has taken it out to the customer. | order.out_for_delivery |
delivered | The agent has delivered it and collected payment, if any was due. This is final. | order.delivered |
failed | Delivery didn’t happen, for example the customer was unreachable. failure_reason says why. | order.failed |
cancelled | Cancelled by you (through the API or dashboard) or by Selligate before it left. | order.cancelled |
returned | The goods came back after delivery. | order.returned |
New statuses may be added in future. Handle any status you don’t recognise by logging it rather than failing.
How an agent is chosen
When you create an order, Selligate picks one agent straight away:
- An active agent in the customer’s state who holds enough stock of every item.
- If several qualify, one in the same city (from
customer.city) comes first. - Then the agent with the fewest orders currently in progress.
If no single agent can fill the whole order, it is rejected with 422 NO_COVERAGE and nothing is created. You can split it into separate orders, or check stock first with List products.
Payment
payment_method | What the agent does | amount_to_collect |
|---|---|---|
pay_on_delivery (default) | Collects the order total from the customer at the door. | The order total |
paid_before_delivery | Just delivers. The customer has already paid you. | 0 |
Prices are in naira. If you leave out unit_price, the product’s price on Selligate is used.
Testing deliveries in the sandbox
Delivery is not automatic in the sandbox, on purpose. Orders stay assigned until you move them, so you can test each webhook step by step. There are two ways:
- The Simulate… menu on Orders From API in the sandbox dashboard.
POST /v1/orders/{id}/simulatefrom your own code.
Each move sends the real webhook, exactly as a live agent’s action would.
Cancelling
You can cancel an order while it is assigned, with POST /orders/{id}/cancel. Once it is out for delivery the API returns 409 ORDER_NOT_CANCELLABLE; contact Selligate support if you still need to stop it.