Orders

Order lifecycle

From the moment you send it, an order moves through a small, fixed set of statuses. Each change triggers a webhook.

assigned→ out_for_delivery→ delivered

The usual path. Along the way an order can also become failed, cancelled or returned.

Statuses

StatusWhat it meansWebhook
assignedAccepted 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_deliveryThe agent has taken it out to the customer.order.out_for_delivery
deliveredThe agent has delivered it and collected payment, if any was due. This is final.order.delivered
failedDelivery didn’t happen, for example the customer was unreachable. failure_reason says why.order.failed
cancelledCancelled by you (through the API or dashboard) or by Selligate before it left.order.cancelled
returnedThe 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:

  1. An active agent in the customer’s state who holds enough stock of every item.
  2. If several qualify, one in the same city (from customer.city) comes first.
  3. 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_methodWhat the agent doesamount_to_collect
pay_on_delivery (default)Collects the order total from the customer at the door.The order total
paid_before_deliveryJust 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:

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.