Appearance
Buy bundle vouchers
Buys one or more voucher PINs for a bundle. The customer loads the PIN themselves.
POST /api/v1/bundles/voucher/buy/{bundle}
bundle is the id from the bundle list.
Bundle vouchers are issued for Econet bundles only. For a bundle of any other network the request fails and nothing is charged.
Body
| Field | Type | Required | Description |
|---|---|---|---|
quantity | integer | Yes | How many vouchers. At least 1. |
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. |
You are charged the bundle's price × quantity.
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/voucher/buy/101 \
-H "Authorization: Bearer YOUR_SERVER_TOKEN" \
-H "Content-Type: application/json" \
-d '{"quantity":2,"reference":"order-5101"}'If your request times out, or you receive a 502 or 504, repeat it with the same reference, or check its status. You get the same PINs, not new ones.
Response 200: delivered
json
{
"success": true,
"message": "Example 1GB Daily purchase was successful",
"data": {
"name": "Example 1GB Daily",
"type": "voucher_bundle",
"id": "00000000-0000-4000-8000-00000000c101",
"reference": "order-5101",
"amount": "2.00",
"voucher_value": "1.00",
"currency": "USD",
"mobile_phone": "",
"status": "processed",
"vouchers": ["000 111 222", "333 444 555"],
"balance": {
"currency": "USD",
"name": "US Dollar",
"profit_on_hold": "0.120",
"balance": "43.00"
},
"commission": "USD0.12",
"receipt_footer": "Get airtime/bundle on your change from as little as 10 cents.",
"created_at": "2026-11-19T10:15:00+02:00",
"recharge_instructions": "*440*112#",
"provider_reference": null,
"product": "bundle_voucher",
"recipient": null,
"transaction_id": "00000000-0000-4000-8000-00000000c101",
"fulfilment": {
"pin": "000111222",
"pins": ["000111222", "333444555"],
"recharge_instructions": "*440*112#"
},
"error_code": null
}
}| Field | Description |
|---|---|
fulfilment.pins | Every PIN, one per voucher, as digits only. |
fulfilment.pin | The first PIN. |
fulfilment.recharge_instructions, recharge_instructions | What the customer dials to load a PIN. |
vouchers | The same PINs with spaces added for reading. |
reference | Your reference, as you sent it. |
status | processed. |
transaction_id, id | The Xash transaction id. |
amount | The total charged. |
voucher_value | The price of one. |
product | bundle_voucher. |
recipient, provider_reference | Always null: voucher PINs are not sent to a phone. |
balance, commission | Your wallet after the purchase, and what you earned. |
A repeat of the same request returns this same answer with the same PINs. Nothing is charged and no new PIN is created. Only balance shows your balance at the time of the repeat.
Two requests are the same purchase when the reference, the bundle and the quantity 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-5101",
"status": "processing",
"provider_reference": null,
"amount": "2.00",
"currency": "USD",
"product": "bundle_voucher",
"recipient": null,
"transaction_id": "00000000-0000-4000-8000-00000000c101",
"fulfilment": null,
"error_code": null,
"created_at": "2026-11-19T10:15:00+02:00"
}
}Bundle vouchers are issued by Xash at once, so this answer is rare. You get it when an earlier request with this reference is still running (data.status is processing), or when that request stopped half-way after the money was taken (unknown). Do not buy again, with this or any other reference. Check the status with the same reference until it is processed or failed. When it becomes processed, the status answer carries the PINs in fulfilment.
Failures
A failure means no voucher was issued and your wallet was not charged. The body has the same shape as the 202 above, with "status": "failed" and the code repeated in data.error_code.
| Status | error_code | Meaning |
|---|---|---|
422 | INSUFFICIENT_FUNDS | Your balance is lower than the bundle's price × quantity. |
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. |
503 | SERVICE_UNAVAILABLE | Vouchers are not issued for this bundle's network. Nothing was charged. |
503 | NOT_SENT | The purchase could not be started. Nothing was charged. |
409 | REFERENCE_CONFLICT | This reference belongs to an earlier purchase for a different bundle or quantity, or for another product. That purchase may have been delivered: look it up before buying again. |
404 | none | Unknown bundle. No purchase was recorded, so the reference is still free. See Retired bundles for the one exception. |
422 | none | quantity is missing or less than 1, 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, including the same PINs, 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, with new PINs each time.
Response 200
json
{
"message": "Example 1GB Daily purchase was successful",
"success": true,
"data": {
"name": "Example 1GB Daily",
"type": "voucher_bundle",
"id": "00000000-0000-7000-8000-00000000c002",
"reference": "00000000C002",
"amount": "2.00",
"voucher_value": "1.00",
"currency": "USD",
"mobile_phone": "",
"status": "success",
"vouchers": ["000 111 222", "333 444 555"],
"balance": {
"currency": "USD",
"name": "US Dollar",
"profit_on_hold": "0.120",
"balance": "43.00"
},
"commission": "USD0.12",
"receipt_footer": "Get airtime/bundle on your change from as little as 10 cents.",
"created_at": "2026-11-19T08:15:00.000000Z",
"recharge_instructions": "*440*112#"
}
}| Field | Description |
|---|---|
vouchers | The PINs, one per voucher, with spaces added for reading. |
amount | The total charged. |
voucher_value | The price of one. |
recharge_instructions | What the customer dials to load a PIN. |
id | The Xash transaction id. |
reference | A short receipt code. |
There is no fulfilment, product or transaction_id, and status is success.
Errors
| Status | message or error_code | Meaning |
|---|---|---|
400 | You do not have enough balance to make this transaction. | Not enough balance. |
400 | Unable to process your request. Please try again later. | Vouchers are not issued for this bundle's network. Nothing was charged. |
422 | error_code is LIMIT_PER_TRANSACTION or LIMIT_DAILY. | A spending limit on your server tokens refused the purchase. Nothing was charged. |
404 | Unknown bundle. | |
422 | quantity is missing or less than 1. |
If you cannot send a reference, treat a timeout as "not known" and check transaction history before trying again.