Skip to content

Outcomes and error codes ​

Read the answer in this order ​

  1. The HTTP status.
  2. error_code, when there is one. It is stable; build your logic on it.
  3. message is for people. Its wording can change. Never match on it.

The three outcomes of a purchase ​

OutcomeHow you recognise itMoneyWhat to do
Delivered200, "success": trueCharged.Record the sale.
Failed4xx or 503, "success": false, an error_code other than OUTCOME_UNKNOWNNot charged, or refunded.Show the failure. A retry needs a new reference, except after a code that points at an earlier purchase.
Not known yet202, error_code is OUTCOME_UNKNOWNHeld.Do not buy again. Check the status.

A fourth case is no answer at all: a timeout, a dropped connection, or a 502/504 page that is not JSON. Treat it exactly like "not known yet". See References and safe retries.

Send a reference

The table above is exact for purchases sent with a reference. Without one, some endpoints use other status codes for the same outcomes (for example a 500 for a definite failure, or a 400 for an unknown one). Each product page has a "Without a reference" section that lists them.

Purchase codes ​

Returned by direct airtime, airtime vouchers, bundles, bundle vouchers, ZESA and DStv when you send a reference, and by the status lookup.

error_codeStatusProductsMeaningRetry?
OUTCOME_UNKNOWN202AllThe provider did not give a clear answer. The money is held.No. Check the status.
INSUFFICIENT_FUNDS422 (DStv: 400)AllYour wallet balance is too low.After adding funds, with a new reference.
LIMIT_PER_TRANSACTION422All, with or without a reference. Also WiFi vouchers and transfers.The amount is above the per-transaction limit on your server tokens. Nothing was charged or sent.With an amount of data.limit or less, or after Xash raises the limit. New reference.
LIMIT_DAILY422All, with or without a reference. Also WiFi vouchers and transfers.The amount would take today's spending above the daily limit on your server tokens. Nothing was charged or sent.With an amount of data.remaining_today or less, or after data.resets_at. New reference.
PROVIDER_REJECTED422Airtime, airtime vouchers (NetOne), bundles, ZESAThe network or utility refused the sale. Refunded.Only if message shows something you can fix. New reference.
OUT_OF_STOCK422Airtime vouchersNot enough network vouchers of this value in stock for the quantity. Nothing was charged.With a lower quantity or another value. New reference.
RECIPIENT_INVALID422ZESAThe meter could not be verified.After correcting the meter number. New reference.
RECIPIENT_INVALID422BundlesThe phone number could not be read. Nothing was recorded: data holds only your reference.After correcting the number. The same reference is still free.
METER_BUSY422ZESAAnother purchase for this meter is running.Not until that purchase has finished and you have checked it. If it was this same order and it did not fail, do not buy again.
DUPLICATE_PURCHASE422ZESAThe meter has an unresolved purchase, or was sold the same amount in the last 10 minutes.Not until you have checked the earlier purchase. It may have been delivered or be held.
DUPLICATE_TRANSACTION400DStvAn earlier payment of the same amount to this smartcard, in the last 10 minutes, was paid, is held or is still running.Not until you have checked the earlier payment. It may have been delivered or be held.
PURCHASE_IN_PROGRESS429DStvAnother payment for this smartcard is running.Not until that payment has finished and you have checked it. If it was this same order and it did not fail, do not pay again.
DSTV_RATE_UNVERIFIED400DStvDStv payments are temporarily unavailable.Later. New reference.
DSTV_LOOKUP_FAILED422DStvThe smartcard could not be verified.After correcting the number. New reference.
DSTV_AMOUNT_CONFIRMATION_FAILED422DStvDStv would not accept this amount for the account.With another package. New reference.
DSTV_ACCOUNT_OWES_MORE422DStvThe account owes exactly one package that costs more than the one chosen, so the payment would leave it short. Nothing was charged.With the account's package. If that is the package you chose, DStv still bills its earlier price: contact support. New reference.
DSTV_PAYMENT_FAILED422DStvDStv refused the payment. Refunded.Later. New reference.
SERVICE_UNAVAILABLE503 (DStv: 400)AllThe product is paused, the network is not available, or vouchers are not issued for that network. Nothing was charged.Later. New reference.
NOT_SENT503AllThe purchase could not be started. Nothing was charged or sent.Yes. New reference.
VEND_FAILED422 on a repeat; in lookupsAllA held purchase was reconciled as failed and refunded.Yes. New reference.
REFERENCE_CONFLICT409AllThe reference belongs to an earlier purchase with different details. That purchase may have been delivered or be held; this answer does not say it failed.Not until you have looked up the reference. A new reference is only for a different purchase.
REFERENCE_NOT_FOUND404LookupYour account has no purchase with this reference.The purchase never arrived; it is safe to send.

A reference that ended in a failure keeps returning that failure, with the same status code. "New reference" above means exactly that. It applies only when the earlier attempt definitely failed: see codes that point at an earlier purchase. Never use a new reference after OUTCOME_UNKNOWN or when you got no answer.

LIMIT_PER_TRANSACTION and LIMIT_DAILY apply only to requests made with a server token, and only on accounts where Xash has set a limit. GET /api/v1/limits shows yours. Both are definite failures, and their data carries the limit figures. Do not confuse LIMIT_DAILY with the 429 rate limit, which counts requests, not money.

Codes without a reference ​

error_codeStatusWhereMeaning
OUTCOME_UNKNOWN202Direct airtime, airtime vouchers (NetOne), bundlesNot known yet. The money is held. data.reference is the Xash transaction id and data.status is on_hold. Do not buy again.
LIMIT_PER_TRANSACTION, LIMIT_DAILY422Every purchase, and transfersA spending limit on your server tokens refused it. Nothing was charged. The code is at the top level of the body on every product, DStv included.
RECENT_DUPLICATE409Direct airtime (NetOne)The same number and amount were topped up successfully in the last 10 minutes.

DStv without a reference puts its code in data.error_code. Besides the codes above it can return DSTV_PAYMENT_REVIEW_REQUIRED, DSTV_PAYMENT_RECEIPT_REVIEW_REQUIRED or DSTV_CONFIRMATION_MISSING with a 503. All three mean not known: the money is held for review.

WiFi voucher codes ​

Returned by WiFi vouchers. These answers also carry a refunded flag.

error_codeStatusMeaningRetry?
OUT_OF_STOCK409Not enough vouchers of this kind. Not charged.With a lower quantity or another kind.
LIMIT_PER_TRANSACTION, LIMIT_DAILY422A spending limit on your server tokens refused the purchase. Not charged. These two answers have no refunded flag.When the amount fits the limit. The same client_reference can be sent again.
VEND_FAILED422The purchase failed. refunded says whether the money was returned (true) or is held for review (false).If refunded is true, yes.
PURCHASE_IN_PROGRESS409A purchase with this client_reference is still running.Check its status first.
IDEMPOTENCY_CONFLICT409This client_reference belongs to an earlier purchase with different details.Not until you have checked that purchase. A new reference is only for a different purchase.
PURCHASE_NOT_FOUND404No WiFi purchase matches this reference.

Deposit codes ​

Returned by the deposit endpoints.

error_codeStatusMeaningRetry?
PAYMENT_START_UNCONFIRMED500It is not known whether the payment was started. The payer may still get a prompt.Repeat with the same request_id where it is honoured. Anywhere else a repeat is a second deposit: find out what happened to the first before starting another.
IDEMPOTENCY_CONFLICT409This request_id was used with different details.This request_id already belongs to a deposit, which may have started. Repeat the original request with this key to get that deposit back, and check it. Use a new request_id only for a different payment.
PAYMENT_NOT_FOUND404No deposit of yours matches.

A deposit that the provider refused answers 422 with a message and no code. A method that is switched off answers 400 with a message and no code.

Failures without a code ​

Many simple failures have only a message:

json
{
  "message": "You do not have enough balance to make this transaction.",
  "success": false
}

This is the shape of most 400 answers from transfers, and from voucher and bundle purchases sent without a reference. The product pages list each one. Where you have to tell them apart, compare the HTTP status and what you sent, not the text.

Standard HTTP answers ​

StatusBodyMeaningWhat to do
401{"message": "Unauthenticated."}The token is missing, wrong or revoked.Fix the token. Do not retry as is.
404{"message": "..."}Unknown path, or the id in the path does not exist or is not yours.Fix the request.
405{"errors": "Method not allowed."}Wrong HTTP method.Fix the request.
422{"message": "...", "errors": {...}}Validation error: a field is missing or invalid. Nothing happened.Fix the request.
429{"message": "Too Many Attempts."}Rate limit. Nothing happened.Wait for Retry-After seconds.
500{"message": "..."}An error on Xash's side. For a purchase, treat the outcome as not known.Check the status before retrying.
502, 504Often an HTML page, not JSONThe request did not get an answer in time. For a purchase, treat the outcome as not known.Check the status before retrying.

Sign-up codes ​

The registration and PIN endpoints in the Xash app section use a different key, code, with the values otp_required and otp_invalid. See Set password.

Getting help ​

When you contact [email protected] about a purchase, send the transaction_id (or the id from the response), your reference, and the time of the request.