Appearance
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
| Field | Type | Required | Description |
|---|---|---|---|
smart_card_number | string | Yes | The smartcard number: 5 to 20 digits. |
package_slug | string | Yes | A slug from the package list. |
currency | string | No | USD if sent. No other value is accepted. |
reference | string | No, but send it | Your 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.
| Field | Description |
|---|---|
client_reference | Your reference, as you sent it. |
reference, transaction_id | The Xash transaction id. |
status | processed. |
amount, currency | What your wallet was charged. |
name, smartcard, customer_number, due_date, services | The account that was paid. Fields DStv did not return are left out. |
package | The 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.
| Status | error_code | Meaning |
|---|---|---|
400 | INSUFFICIENT_FUNDS | Your balance is lower than the package amount. |
422 | LIMIT_PER_TRANSACTION, LIMIT_DAILY | A spending limit on your server tokens refused the payment. Nothing was charged. data also carries the limit figures. |
400 | SERVICE_UNAVAILABLE | DStv payments are switched off. |
400 | DSTV_RATE_UNVERIFIED | DStv payments are temporarily unavailable. Try again later with a new reference. |
400 | DUPLICATE_TRANSACTION | An 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. |
429 | PURCHASE_IN_PROGRESS | Another payment for this smartcard is running right now. Wait for it to finish and check it before paying again. |
422 | DSTV_LOOKUP_FAILED | The smartcard could not be verified. Nothing was charged. |
422 | DSTV_AMOUNT_CONFIRMATION_FAILED | DStv would not accept this amount for the account. Nothing was charged. |
422 | DSTV_ACCOUNT_OWES_MORE | The 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. |
422 | DSTV_PAYMENT_FAILED | DStv refused the payment. Refunded. |
503 | NOT_SENT | The payment could not be started. Nothing was charged or sent to DStv. |
409 | REFERENCE_CONFLICT | This reference belongs to an earlier payment for a different smartcard or package. That payment may have been made: look it up before paying again. |
422 | none | A 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:
| Status | Body | Meaning |
|---|---|---|
200 | The account fields, package, and data.reference as the Xash transaction id. | Paid. |
400 | message says why: not enough balance, service not active, duplicate. For an unverified rate, data.error_code is DSTV_RATE_UNVERIFIED. | Failed. Nothing was charged. |
429 | message says a payment for this smartcard is in progress. | Wait and check before trying again. |
422 | data.error_code, and data.refund_status of refunded when money had been taken. | Failed. Not charged, or refunded. |
422 | A top-level error_code of LIMIT_PER_TRANSACTION or LIMIT_DAILY. | A spending limit on your server tokens refused the payment. Nothing was charged. |
503 | data.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.