On-Demand (One-Time Charge)
20 - On-Demand (One-Time Charge)#
On-Demand Charging Flow OverviewThe on-demand charging flow is used for one-time purchases where the user is charged immediately for a specific product or service. The process starts when the partner sends a charge request to the API. The XL DCB system then attempts to charge the user in real time. If the charge is successful, the system sends a callback notification to the partner confirming the successful transaction so the service or content can be delivered to the user.The partner may also check the transaction status using the status endpoint to ensure the final result.20.1 Create Charge (OTP Flow)#
POST /partner-dcb/v1/on-demand/chargesRequest Body#
{
"payment_method": "XL",
"transaction_details": {
"partner_ref_id": "8d7f32bc-21fe-4eb3-b16c-ec549f4b06c9",
"amount": 2220,
"currency": "IDR"
},
"customer_details": {
"msisdn": "6287800000000"
},
"item_details": {
"id": "IM0001",
"name": "OD 2000",
"description": "On-demand purchase"
}
}
Response (202) - OTP Required#
{
"success": true,
"correlation_id": "8002d952-0007-2400-b63f-84710c7967bb",
"code": "CHARGE_CREATED",
"message": "Charge created successfully",
"data": {
"transaction_id": "213390B1-FB19-4E14-BE24-34D377984025",
"partner_ref_id": "8d7f32bc-21fe-4eb3-b16c-ec549f4b06c9"
}
}
20.2 Confirm OTP (Execute Charge)#
POST /partner-dcb/v1/on-demand/charges/{transaction_id}/otp/confirmRequest Body#
{
"payment_method": "XL",
"transaction_details": {
"otp": "123456"
}
}
Response (200)#
{
"success": true,
"correlation_id": "8004b951-0804-e900-b63f-84710c7967bb",
"code": "OTP_CONFIRMED",
"message": "OTP Confirmed Successfully",
"data": {
"transaction_id": "213390B1-FB19-4E14-BE24-34D377984025"
}
}
20.3 Check Transaction#
GET /partner-dcb/v1/on-demand/charges/check?transaction_id={transaction_id}&payment_method=XLQuery#
Response (200)#
{
"success": true,
"correlation_id": "8005c7c8-0800-e200-b63f-84710c7967bb",
"code": "TRANSACTION_FOUND",
"message": "Transaction found",
"data": {
"status": "Success",
"failure_reason": "",
"failure_message": "",
"event_type": "OneTimePurchase",
"payment_method": "XL",
"amount": 3330,
"msisdn": "6287800000000",
"transaction_date": "2026-05-08T10:01:42+07:00",
"item_id": "IM0002",
"item_name": "MIA 3330",
"item_description": "MIA 3330",
"partner_ref_id": "0b5efb01-3ee5-491c-95ee-088316ca67b0",
"transaction_id": "E01A7B3F-2B0C-42E7-9918-FA3333F41797",
"timestamp": "2026-05-11T13:44:34+07:00"
}
}
Modified at 2026-05-13 04:47:09