Skip to content

Pay a subscription ​

Pays a package onto a smartcard account. Your wallet is charged the package's amount in USD.

POST /api/v1/dstv/purchase

Body ​

FieldTypeRequiredDescription
smart_card_numberstringYesThe smartcard number: 5 to 20 digits.
package_slugstringYesA slug from the package list.
currencystringNoUSD if sent. No other value is accepted.
referencestringNo, but send itYour own id for this payment. 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/dstv/purchase \
  -H "Authorization: Bearer YOUR_SERVER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"smart_card_number":"1000000001","package_slug":"compact","reference":"order-3001"}'

A payment waits for DStv and can take 20 seconds or more. If your request times out, or you receive a 502 or 504, repeat it with the same reference.

Response 200: paid ​

json
{
  "success": true,
  "message": "DStv payment completed successfully.",
  "data": {
    "status": "processed",
    "provider_reference": null,
    "amount": "35.00",
    "currency": "USD",
    "product": "dstv",
    "recipient": "1000000001",
    "transaction_id": "00000000-0000-4000-8000-00000000d001",
    "fulfilment": null,
    "error_code": null,
    "created_at": "2026-11-19T10:15:00+02:00",
    "name": "T EXAMPLE",
    "smartcard": "1000000001",
    "customer_number": "100000001",
    "services": ["Compact"],
    "package": {
      "name": "Compact",
      "slug": "compact",
      "amount": 35
    },
    "reference": "00000000-0000-4000-8000-00000000d001",
    "client_reference": "order-3001"
  }
}

reference means something different here

In a DStv answer, data.reference is the Xash transaction id and your own reference is in data.client_reference. For every other product, data.reference is your reference. This difference is kept for the Xash app.

FieldDescription
client_referenceYour reference, as you sent it.
reference, transaction_idThe Xash transaction id.
statusprocessed.
amount, currencyWhat your wallet was charged.
name, smartcard, customer_number, due_date, servicesThe account that was paid. Fields DStv did not return are left out.
packageThe package that was paid for.

A repeat of the same request returns this same answer and does not pay again. 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-3001",
    "status": "unknown",
    "provider_reference": null,
    "amount": "35.00",
    "currency": "USD",
    "product": "dstv",
    "recipient": "1000000001",
    "transaction_id": "00000000-0000-4000-8000-00000000d001",
    "fulfilment": null,
    "error_code": null,
    "created_at": "2026-11-19T10:15:00+02:00"
  }
}

DStv did not confirm the payment. The money is held while Xash staff check it. Do not pay again. Check the status with the same reference until it is paid or failed. In this answer data.reference is your reference.

Failures ​

A failure means the smartcard was not paid 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.

Statuserror_codeMeaning
400INSUFFICIENT_FUNDSYour balance is lower than the package amount.
422LIMIT_PER_TRANSACTION, LIMIT_DAILYA spending limit on your server tokens refused the payment. Nothing was charged. data also carries the limit figures.
400SERVICE_UNAVAILABLEDStv payments are switched off.
400DSTV_RATE_UNVERIFIEDDStv payments are temporarily unavailable. Try again later with a new reference.
400DUPLICATE_TRANSACTIONAn earlier payment of the same amount to this smartcard, in the last 10 minutes, was paid, is held or is still running. Check that payment before paying again.
429PURCHASE_IN_PROGRESSAnother payment for this smartcard is running right now. Wait for it to finish and check it before paying again.
422DSTV_LOOKUP_FAILEDThe smartcard could not be verified. Nothing was charged.
422DSTV_AMOUNT_CONFIRMATION_FAILEDDStv would not accept this amount for the account. Nothing was charged.
422DSTV_ACCOUNT_OWES_MOREThe account owes exactly one package that costs more than the one chosen, so the payment would leave it short. Nothing was charged. Pay for the account's package. If that is the package you chose, DStv still bills its earlier price: contact support.
422DSTV_PAYMENT_FAILEDDStv refused the payment. Refunded.
503NOT_SENTThe payment could not be started. Nothing was charged or sent to DStv.
409REFERENCE_CONFLICTThis reference belongs to an earlier payment for a different smartcard or package. That payment may have been made: look it up before paying again.
422noneA field is invalid or package_slug is not on sale. Validation error. No payment was recorded, so the reference is still free.

Note that DStv uses 400 and 429 where the other products use 422. Branch on error_code.

A failed reference stays failed. Repeating it returns the same failure. To try again, send a new reference. DUPLICATE_TRANSACTION, PURCHASE_IN_PROGRESS and REFERENCE_CONFLICT are different: 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 payment (subject to the duplicate rule), and the answers differ:

StatusBodyMeaning
200The account fields, package, and data.reference as the Xash transaction id.Paid.
400message says why: not enough balance, service not active, duplicate. For an unverified rate, data.error_code is DSTV_RATE_UNVERIFIED.Failed. Nothing was charged.
429message says a payment for this smartcard is in progress.Wait and check before trying again.
422data.error_code, and data.refund_status of refunded when money had been taken.Failed. Not charged, or refunded.
422A top-level error_code of LIMIT_PER_TRANSACTION or LIMIT_DAILY.A spending limit on your server tokens refused the payment. Nothing was charged.
503data.requires_review is true, data.refund_status is held_for_review, data.reference is the transaction id.Not known. The money is held for review. Do not pay again.

In these answers the code is inside data, not at the top level. The two limit codes are the exception.