Core concepts
Order lifecycle
A purchase reserves funds, goes to a provider and ends in exactly one final status. Your integration only needs to react to the final ones.
Read the HTTP status first
| HTTP | Order status | What to do |
|---|---|---|
| 200 | SUCCESS_SETTLED | Delivered. Show the result (and the token or PIN, if any) to your customer. |
| 202 | PENDING_PROVIDER_QUERY | Not final. Wait for the webhook, or check the order at the poll_url path in the response. Do not buy again. |
| 422 | FAILED_UNRESERVED | The provider refused it. Nothing was charged. The error code is VTU_ORDER_FAILED. |
All statuses
| Status | Final | Meaning |
|---|---|---|
| INITIATED | No | The order was created. |
| FUNDS_RESERVED | No | The amount is held in your wallet. |
| DISPATCHING_PROVIDER | No | The order is being sent to the provider. |
| PENDING_PROVIDER_QUERY | No | The provider has not confirmed yet; Pay Sef keeps checking. |
| ADMIN_MANUAL_REVIEW | No | Pay Sef staff are reviewing the order. Funds stay reserved. |
| SUCCESS_SETTLED | Yes | Delivered and charged. |
| FAILED_UNRESERVED | Yes | Failed, immediately or after a pending period; the reservation was released and nothing was charged. |
| FAILED_REFUNDED | Yes | Refunded by Pay Sef after a review, for example from manual review or after an order was reported as not delivered. |
The short view: customer_status and money_location
Every order also carries two fields that collapse the eight statuses into what a customer needs to know. Branch your integration on customer_status: it has only three values and is the same on orders, transaction history and webhooks, whichever network delivered the order. Keep status for your records.
| status | customer_status | money_location |
|---|---|---|
| INITIATED | processing | not_charged |
| FUNDS_RESERVED, DISPATCHING_PROVIDER, PENDING_PROVIDER_QUERY, ADMIN_MANUAL_REVIEW | processing | held |
| SUCCESS_SETTLED | delivered | spent |
| FAILED_UNRESERVED, FAILED_REFUNDED | failed | refunded |
When an order fails, failure_reason is written for your customer (This order did not go through. Your money is back in your wallet.) and is safe to show as it is. An order in ADMIN_MANUAL_REVIEW carries one too: We are checking this order with the network. Your money is on hold, not spent.
Statuses can be added
Treat any status you do not recognise as not final, and keep checking the order. In rare cases Pay Sef corrects a final order after review (for example refunding one that was reported as not delivered); you get a webhook when that happens.
Resolving a pending order
- Store the
order_id,order_refand your ownreferencefrom the 202 response. - Wait for an
order.success,order.failedororder.refundedwebhook. - If no webhook arrives, call GET /vtu/orders/verify/{reference} with back-off (for example after 10 s, 30 s, 1 min, then every 5 min).
- Tell your customer the result only when the status is final.
Amounts on an order
face_value_kobo is the value delivered to the recipient (for example 50000 for ₦500 of airtime). amount_debited_kobo is what your wallet paid after any discount for your account type. Amounts are whole kobo (₦1 = 100 kobo).