# Cancel Order API

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.

## Overview

Use Case :&#x20;

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**

***

## Supported Payment Channels

| Channel               | Support | Notes                         |
| --------------------- | ------- | ----------------------------- |
| Bank Transfer         | ✅       | (exclude BTN, BNC, BPD, OCBC) |
| QRIS                  | ✅       | -                             |
| Convenience Store     | ✅       | -                             |
| Cards                 | ❌       | -                             |
| eWallet               | ❌       | -                             |
| Direct Debit          | ❌       | -                             |
| Paylater              | ❌       | -                             |
| Karu Kredit Indonesia | ❌       | -                             |
| Digital Banking       | ❌       | -                             |

{% hint style="danger" %}
Transactions that are already **paid or expired cannot be cancelled**.
{% endhint %}

***

## Activation

This feature is **not enabled by default**.

{% hint style="warning" %}
Merchants must request activation from the **DOKU Team**.
{% endhint %}

***

## How to Use

#### API Endpoint

| Type                      | Value                                                    |
| ------------------------- | -------------------------------------------------------- |
| HTTP Method               | POST                                                     |
| API Endpoint (Sandbox)    | <https://api-sandbox.doku.com/checkout/v3/cancellations> |
| API Endpoint (Production) | <https://api.doku.com/checkout/v3/cancellations>         |

### Request Header

Here is the sample of request header to cancel the order

```
Client-Id: MCH-0001-10791114622547
Request-Id: fdb69f47-96da-499d-acec-7cdc318ab2fe
Request-Timestamp: 2020-08-11T08:45:42Z
Signature: HMACSHA256=1jap2tpgvWt83tG4J7IhEwUrwmMt71OaIk0oL0e6sPM=
```

<table><thead><tr><th width="167">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>client-id</code></strong></td><td>Client ID retrieved from DOKU Back Office</td></tr><tr><td><strong><code>request-id</code></strong></td><td>Unique random string (max 128 characters) generated from merchant side to protect duplicate request</td></tr><tr><td><strong><code>request-timestamp</code></strong></td><td>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</td></tr><tr><td><strong><code>signature</code></strong></td><td>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 <a href="../../../get-started-with-doku-api/signature-component/non-snap/signature-component-from-request-header">this section</a> to generate the signature</td></tr></tbody></table>

Here is the sample of request body to cancel the order :&#x20;

```json
{
"order": {
  "invoice_number": "PTR-JessicaTest"
},
  "payment": {
      "original_request_id": "7a38dc09-0fa5-4637-9b57-12ac2c61d90a"
  },
"note": "cancel order"
}
```

<table><thead><tr><th>Body Parameter</th><th width="122">Type</th><th>Mandatory</th><th valign="bottom">Description</th></tr></thead><tbody><tr><td><code>order.invoice_number</code></td><td><code>string</code></td><td>Mandatory</td><td valign="bottom">Using the invoice number that used to generate the URL</td></tr><tr><td><code>payment.original_request_id</code></td><td><code>string</code></td><td>Mandatory</td><td valign="bottom">Using the original request id that used to generate the URL</td></tr><tr><td><code>note</code></td><td><code>string</code></td><td>Mandatory</td><td valign="bottom">Send the note for sync the data</td></tr></tbody></table>

## Monitor the Order

Cancelled orders will appear in the **Checkout Order Report** with the status: `CANCELLED`

<figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2FVdUYzVIr8xilsStSmFqN%2FScreenshot%202026-03-10%20at%2011.49.13.png?alt=media&#x26;token=5ef22999-d391-4b6a-a87a-8cc7bbc7da6a" alt=""><figcaption></figcaption></figure>
