Cancel Order API
Last updated
The Cancel Order API allows merchants to cancel an unpaid checkout order before the checkout URL expires. Once cancelled, the checkout session becomes invalid and the customer will no longer be able to complete the payment.
This API helps merchants manage order changes and maintain accurate order status in their systems.
Use Case :
Merchants may need to cancel a checkout order when:
The customer changes their order
The merchant needs to update inventory
The merchant wants to invalidate an existing checkout link
The merchant does not want to wait for the checkout URL to expire
Bank Transfer
✅
(exclude BTN, BNC, BPD, OCBC)
QRIS
✅
-
Convenience Store
✅
-
Cards
❌
-
eWallet
❌
-
Direct Debit
❌
-
Paylater
❌
-
Karu Kredit Indonesia
❌
-
Digital Banking
❌
-
Transactions that are already paid or expired cannot be cancelled.
This feature is not enabled by default.
Merchants must request activation from the DOKU Team.
HTTP Method
POST
API Endpoint (Sandbox)
https://api-sandbox.doku.com/checkout/v3/cancellations
API Endpoint (Production)
https://api.doku.com/checkout/v3/cancellations
Here is the sample of request header to cancel the order
client-id
Client ID retrieved from DOKU Back Office
request-id
Unique random string (max 128 characters) generated from merchant side to protect duplicate request
request-timestamp
Timestamp request on UTC time in ISO8601 UTC+0 format. It means to proceed transaction on UTC+7 (WIB), merchant need to subtract time with 7. Ex: to proceed transaction on September 22th 2020 at 08:51:00 WIB, the timestamp should be 2020-09-22T01:51:00Z
signature
Security parameter that needs to be generated on merchant Backend and placed to the header request to ensure that the request is coming from valid merchant. Please refer to this section to generate the signature
Here is the sample of request body to cancel the order :
order.invoice_number
string
Mandatory
Using the invoice number that used to generate the URL
payment.original_request_id
string
Mandatory
Using the original request id that used to generate the URL
note
string
Mandatory
Send the note for sync the data
Cancelled orders will appear in the Checkout Order Report with the status: CANCELLED

Last updated
Client-Id: MCH-0001-10791114622547
Request-Id: fdb69f47-96da-499d-acec-7cdc318ab2fe
Request-Timestamp: 2020-08-11T08:45:42Z
Signature: HMACSHA256=1jap2tpgvWt83tG4J7IhEwUrwmMt71OaIk0oL0e6sPM={
"order": {
"invoice_number": "PTR-JessicaTest"
},
"payment": {
"original_request_id": "7a38dc09-0fa5-4637-9b57-12ac2c61d90a"
},
"note": "cancel order"
}