Appearance
Buy direct airtime
Loads airtime straight onto a mobile number. The network is worked out from the number.
POST /api/v1/airtime/direct
Body
| Field | Type | Required | Description |
|---|---|---|---|
mobile_phone | string | Yes | The number to top up. A Zimbabwean mobile number on a network with has_direct_airtime (list). |
amount | number | Yes | At least 0.1. |
currency | string | Yes | The wallet to pay from, for example USD. |
reference | string | No, but send it | Your own id for this purchase. Up to 120 characters: letters, digits, :, ., _ and -. Makes the request safe to repeat. |
Example
bash
curl -X POST https://app.xash.co.zw/api/v1/airtime/direct \
-H "Authorization: Bearer YOUR_SERVER_TOKEN" \
-H "Content-Type: application/json" \
-d '{"mobile_phone":"0770000001","amount":1,"currency":"USD","reference":"order-1001"}'Response 200: delivered
json
{
"success": true,
"message": "Recharge to +263770000001 was successful",
"data": {
"name": "Econet airtime",
"type": "direct_airtime",
"id": "00000000-0000-4000-8000-00000000a001",
"reference": "order-1001",
"amount": "1.00",
"currency": "USD",
"mobile_phone": "+263770000001",
"status": "processed",
"balance": {
"currency": "USD",
"name": "US Dollar",
"profit_on_hold": "0.060",
"balance": "49.00"
},
"commission": "USD0.06",
"receipt_footer": "Get airtime/bundle on your change from as little as 10 cents.",
"created_at": "2026-11-19T10:15:00+02:00",
"provider_reference": null,
"product": "airtime",
"recipient": "+263770000001",
"transaction_id": "00000000-0000-4000-8000-00000000a001",
"fulfilment": null,
"error_code": null
}
}| Field | Description |
|---|---|
reference | Your reference, as you sent it. |
status | processed. |
transaction_id, id | The Xash transaction id. Quote it to support. It appears as id in transaction history. |
amount, currency | What your wallet was charged. |
balance | Your wallet after the purchase. |
commission | What you earned on this sale. |
product | airtime. |
recipient, mobile_phone | The number that was topped up. |
provider_reference, fulfilment | Always null for airtime. |
A repeat of the same request returns this same answer and does not top up again.
Response 202: not known yet
json
{
"success": false,
"error_code": "OUTCOME_UNKNOWN",
"message": "This purchase is still being confirmed. Do not buy again; check its status with this reference.",
"data": {
"reference": "order-1001",
"status": "unknown",
"provider_reference": null,
"amount": "1.00",
"currency": "USD",
"product": "airtime",
"recipient": "+263770000001",
"transaction_id": "00000000-0000-4000-8000-00000000a001",
"fulfilment": null,
"error_code": null,
"created_at": "2026-11-19T10:15:00+02:00"
}
}The network did not give a clear answer. The money is held. Do not buy again. Check the status later with the same reference. data.status is processing instead of unknown when an earlier request with this reference is still running.
Failures
A failure means nothing was delivered and your wallet was not charged, or was refunded.
json
{
"success": false,
"error_code": "INSUFFICIENT_FUNDS",
"message": "You do not have enough balance to make this transaction.",
"data": {
"reference": "order-1002",
"status": "failed",
"provider_reference": null,
"amount": "500.00",
"currency": "USD",
"product": "airtime",
"recipient": "+263770000001",
"transaction_id": "00000000-0000-4000-8000-00000000a002",
"fulfilment": null,
"error_code": "INSUFFICIENT_FUNDS",
"created_at": "2026-11-19T10:16:00+02:00"
}
}| Status | error_code | Meaning |
|---|---|---|
422 | INSUFFICIENT_FUNDS | Your balance is lower than the amount. |
422 | LIMIT_PER_TRANSACTION, LIMIT_DAILY | A spending limit on your server tokens refused the purchase. Nothing was charged. data also carries the limit figures. |
422 | PROVIDER_REJECTED | The network refused the top-up. message carries its reason. Refunded. |
503 | SERVICE_UNAVAILABLE | This network is not available right now. Nothing was charged. |
503 | NOT_SENT | The purchase could not be started. Nothing was charged or sent to the network. |
409 | REFERENCE_CONFLICT | This reference belongs to an earlier purchase for a different number, amount or currency. That purchase may have been delivered: look it up before buying again. |
422 | none | A field is invalid. Validation error. No purchase was recorded, so the reference is still free. |
A failed reference stays failed. Repeating it returns the same failure. To try the purchase again, send a new reference. REFERENCE_CONFLICT is not such a failure: see codes that point at an earlier purchase.
Without a reference
The endpoint also works without reference, as it always has. Then a repeat is a new purchase, and the answers are less precise:
| Status | Body | Meaning |
|---|---|---|
200 | data.reference is a short receipt code, data.status is success, data.id is the transaction id. | Delivered. |
400 | {"success": false, "message": "You do not have enough balance to make this transaction."} | Not enough balance. |
400 | message from the network, data.reference is the transaction id. | The network refused it. Refunded. |
202 | error_code is OUTCOME_UNKNOWN, data.reference is the transaction id, data.status is on_hold. | Not known yet. Do not buy again. Find the transaction in history with include_pending. |
409 | error_code is RECENT_DUPLICATE. | NetOne only: the same number and amount were topped up successfully in the last 10 minutes. |
422 | error_code is LIMIT_PER_TRANSACTION or LIMIT_DAILY. | A spending limit on your server tokens refused the purchase. Nothing was charged. |
500 | {"success": false, "message": "..."} | Airtime is not set up for this network. Nothing was charged. |
If you cannot send a reference, treat a timeout as "unknown" and check transaction history before trying again.