How the Prepaid Model Works
Before sending OTPs, you top up your account balance through the OTP.ID dashboard. Your balance is stored in IDR as an integer (representing the exact Rupiah amount). Each delivery attempt has an associatedprice — the cost in IDR for that channel and transaction. When OTP.ID successfully delivers an OTP, the price is atomically deducted from your balance at the moment of delivery.
To top up your balance, log in to the OTP.ID dashboard and follow the top-up flow. There is no API endpoint for initiating a top-up.
When Your Balance Is (and Is Not) Deducted
Not every API call results in a charge. OTP.ID only deducts your balance when value is delivered.Balance IS deducted when:
- The channel vendor successfully delivers the OTP — the transaction status is
sentorsuccess. - The deduction happens atomically at the moment of delivery, not at request time.
Balance is NOT deducted when:
- Vendor delivery fails — the transaction is created and you receive a
200 OKresponse, butstatusisfailed. No charge is applied. - Idempotent replay — if you repeat a request with the same
external_id, OTP.ID recognises it as a duplicate and does not create a new transaction or deduct a new charge.
Even when delivery fails, OTP.ID returns HTTP
200 OK with status: "failed" in the response body. Always check the status field — a 200 response does not guarantee a charge was made or that the OTP was delivered.Billing Fields in API Responses
Every transaction response includes two billing-related fields.Successful Delivery
When the OTP is delivered successfully,last_balance is lower than your pre-request balance by exactly price.
Failed Delivery
When the vendor cannot deliver the OTP,last_balance is unchanged — your balance before and after the request is the same.
price is still 350 IDR (showing what would have been charged), but last_balance remains 100,000 IDR because no deduction occurred.
Insufficient Balance
If your balance is too low to cover the cost of the requested transaction, OTP.ID returns an HTTP402 error before attempting delivery.

