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; Aboki Data keeps checking. |
| ADMIN_MANUAL_REVIEW | No | Aboki Data staff are reviewing the order. Funds stay reserved. |
| SUCCESS_SETTLED | Yes | Delivered and charged. |
| FAILED_UNRESERVED | Yes | Failed before any charge; the reservation was released. |
| FAILED_REFUNDED | Yes | Failed after the provider was contacted; the amount was returned to your wallet. |
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 on status for your records and show these two:
| 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 (for example This order didn't go through. Your money is back in your wallet.) and is safe to show as it is.
Statuses can be added
Treat any status you do not recognise as not final, and keep checking the order. In rare cases Aboki Data 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).