> For the complete documentation index, see [llms.txt](https://developers.doku.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.doku.com/accept-payments/doku-checkout/additional-feature/cancel-order-api.md).

# 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="/pages/VogdJfoJtS2yXvClOsrc">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="/files/2dZh2CnGZh16uSkY8He9" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developers.doku.com/accept-payments/doku-checkout/additional-feature/cancel-order-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
