Appearance
Buy a bundle
Loads a bundle onto a mobile number.
POST /api/v1/bundles/buy/{bundle}
bundle is the id from the bundle list.
Body
| Field | Type | Required | Description |
|---|---|---|---|
mobile_phone | string | Yes | The number to load the bundle onto. It must be on the bundle's network. |
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. |
The price and currency come from the bundle. You do not send an amount.
Already integrated without a reference?
Nothing changes for you. A request without reference is answered exactly as it always was: see Without a reference. The answers on this page apply only when you send one.
Example
bash
curl -X POST https://app.xash.co.zw/api/v1/bundles/buy/101 \
-H "Authorization: Bearer YOUR_SERVER_TOKEN" \
-H "Content-Type: application/json" \
-d '{"mobile_phone":"0770000001","reference":"order-5001"}'If your request times out, or you receive a 502 or 504, repeat it with the same reference, or check its status.
Response 200: delivered
json
{
"success": true,
"message": "Example 1GB Daily bundle purchased successfully",
"data": {
"name": "Example 1GB Daily",
"type": "direct_bundle",
"id": "00000000-0000-4000-8000-00000000c001",
"reference": "order-5001",
"amount": "1.00",
"currency": "USD",
"mobile_phone": "0770000001",
"status": "processed",
"balance": {
"currency": "USD",
"name": "US Dollar",
"profit_on_hold": "0.060",
"balance": "45.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": "bundle",
"recipient": "+263770000001",
"transaction_id": "00000000-0000-4000-8000-00000000c001",
"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: the bundle's price. |
balance | Your wallet after the purchase. |
commission | What you earned on this sale. |
product | bundle. |
recipient, mobile_phone | The number the bundle was loaded onto. |
provider_reference, fulfilment | Always null for a bundle: it goes straight to the phone. |
A repeat of the same request returns this same answer and does not load the bundle again. Only balance shows your balance at the time of the repeat.
Two requests are the same purchase when the reference, the bundle and the phone number match. A repeat is matched on the price first charged, so a later price change does not turn it into a conflict.
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-5001",
"status": "unknown",
"provider_reference": null,
"amount": "1.00",
"currency": "USD",
"product": "bundle",
"recipient": "+263770000001",
"transaction_id": "00000000-0000-4000-8000-00000000c001",
"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 and is not refunded automatically. Do not buy again, with this or any other reference: the bundle may already be on the phone. Check the status with the same reference until it is processed or failed. data.status is processing instead of unknown when an earlier request with this reference is still running.
Failures
A failure means the bundle was not loaded and your wallet was not charged, or was refunded. The body has the same shape as the 202 above, with "status": "failed" and the code repeated in data.error_code.
json
{
"success": false,
"error_code": "INSUFFICIENT_FUNDS",
"message": "You do not have enough balance to make this transaction.",
"data": {
"reference": "order-5002",
"status": "failed",
"provider_reference": null,
"amount": "1.00",
"currency": "USD",
"product": "bundle",
"recipient": "+263770000001",
"transaction_id": "00000000-0000-4000-8000-00000000c002",
"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 bundle's price. |
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 bundle. message carries its reason. Refunded. |
503 | SERVICE_UNAVAILABLE | Bundles for this network are 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 bundle or number, or for another product. That purchase may have been delivered: look it up before buying again. |
422 | RECIPIENT_INVALID | The phone number could not be read. data holds only your reference. No purchase was recorded, so the reference is still free. |
404 | none | Unknown bundle. No purchase was recorded, so the reference is still free. See Retired bundles for the one exception. |
422 | none | mobile_phone is missing, is not a Zimbabwean number, or is on a network that has no bundles; or reference is malformed. 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.
A reference that is an empty string, null, not a string, longer than 120 characters, or that has any character other than letters, digits, :, ., _ and -, is a validation error. It is never treated as "no reference".
Retired bundles
Networks withdraw bundles, and a withdrawn bundle is removed from the bundle list. Its id then answers 404.
A repeat is still honoured. If you send a reference you have already used, to the same bundle id, you get the stored outcome of the original purchase, or 409 REFERENCE_CONFLICT if the details differ. So a retry after a timeout is safe even if the bundle was withdrawn in between.
Every other request for a removed bundle answers 404, and buys nothing.
Without a reference
The endpoint also works without reference, as it always has. Nothing about these answers has changed. Then a repeat is a new purchase: sending the request twice buys twice.
Response 200
json
{
"message": "Example 1GB Daily bundle purchased successfully",
"success": true,
"data": {
"name": "Example 1GB Daily",
"type": "direct_bundle",
"id": "00000000-0000-7000-8000-00000000c001",
"reference": "00000000C001",
"amount": "1.00",
"currency": "USD",
"mobile_phone": "0770000001",
"status": "success",
"balance": {
"currency": "USD",
"name": "US Dollar",
"profit_on_hold": "0.060",
"balance": "45.00"
},
"commission": "USD0.06",
"receipt_footer": "Get airtime/bundle on your change from as little as 10 cents.",
"created_at": "2026-11-19T08:15:00.000000Z"
}
}id is the Xash transaction id. reference is a short receipt code. status is success, and there is no product, recipient, transaction_id or fulfilment.
Errors
| Status | message or error_code | Meaning |
|---|---|---|
400 | You do not have enough balance to make this transaction. | Not enough balance for the bundle's price. |
400 | Invalid phone. Verify and try again | The number could not be read. |
400 | Any other message, with data.reference. | The network refused it. Refunded. |
422 | error_code is LIMIT_PER_TRANSACTION or LIMIT_DAILY. | A spending limit on your server tokens refused the purchase. Nothing was charged. |
202 | error_code is OUTCOME_UNKNOWN, data.reference is the transaction id, data.status is on_hold. | The network did not give a clear answer. The money is held. Do not buy again. Find the transaction in history with include_pending, or contact support with the reference. |
404 | Unknown bundle. | |
422 | mobile_phone is missing, is not a Zimbabwean number, or is on a network that has no bundles. |
If you cannot send a reference, treat a timeout as "not known" and check transaction history before trying again.