Skip to main content

Verify and charge

Checks the code and charges the subscriber once.

POST /api/sp/v1/dcb/purchase/verify

Request​

FieldTypeNotes
msisdnstringThe subscriber's number.
shortCodestringThe short code your credential is bound to.
serviceIdintegerThe service.
spTransactionIdstringYours, unique per attempt. See Idempotency.
pinstringThe one-time code the subscriber typed. Four digits, the same length as a subscription PIN and the same as the legacy platform. Send it as a JSON string, not a number: the field is validated as a string and a numeric value is rejected. A code may also begin with 0 ("0042"), which a numeric type would destroy.
tistringOptional. The anti-fraud transaction identifier from your script call.
tsstringOptional. The matching timestamp.

amount is prohibited here too. The price is the service's, not the request's.

A purchase is not anti-fraud screened​

ti and ts are optional here and a purchase is never refused for fraud. If you send them they are accepted and stored against the purchase, which is useful if a charge is ever queried; they are not used to screen it. You do not need to run the anti-fraud script before a purchase.

⚠️ The subscription flow is different and still screens. POST /api/sp/v1/dcb/subscription/verify requires ti and ts and can refuse for fraud. Do not carry this page's behaviour across to it.

Order of operations​

  1. The code is checked.
  2. Eligibility is re-checked.
  3. The charge is made.

Nothing is charged until both checks pass, which is why a refusal at either step leaves the subscriber's balance untouched.

Response​

{
"requestId": "01JB2K9WQ4X7YH3M8N5P6R7T8V",
"code": "OK",
"data": {
"purchaseId": "01JB2K9WQ4X7YH3M8N5P6R7T8V",
"amount": 500,
"currency": "IQD",
"chargedAt": "2026-09-13T08:22:40.000000Z"
}
}
FieldNotes
purchaseIdOurs. Store it - it is what a refund or a dispute is quoted against.
amountWhat was charged.
currencyIQD.
chargedAtISO 8601.

A failed charge returns these same four fields, under data, alongside INSUFFICIENT_BALANCE or CHARGE_FAILED. So store data on both outcomes and you have one record per attempt rather than a gap wherever a charge failed. See the envelope.

Creates nothing ongoing​

A purchase is a single charge. No subscription is created, nothing renews, and there is nothing to unsubscribe from afterwards.

What can refuse it​

The PIN codes and the eligibility codes, plus CHARGE_FAILED and INSUFFICIENT_BALANCE: the last two meaning the operator declined the charge itself.

OPERATOR_UNAVAILABLE (503, retryable: true) is different from both. The operator's profile service did not answer, so the charge was not attempted: nothing was charged and no purchaseId exists. The OTP has been used by then, so the retry is a new purchase: issue a new OTP and use a new spTransactionId once the operator answers again. A same-spTransactionId replay returns this same answer and still charges nothing.

INSUFFICIENT_BALANCE is worth handling distinctly in your UI. It is the one refusal the subscriber can do something about immediately.