# Cancel Order

The Cancel Order API is used to cancel a previously generated transaction that has not yet been paid by the customer. The purpose of this API is to prevent payment from being made on transactions that are no longer valid or intended. This API is typically used in scenarios such as:

* The customer cancels the order before completing the payment.
* The customer wishes to change the selected payment method.
* The merchant decides not to proceed with the transaction for specific reasons.

Once the cancellation is successfully executed, the transaction status will be updated to cancelled and it can no longer be paid.

| Environment | Method | URL                                                                                                                          |
| ----------- | ------ | ---------------------------------------------------------------------------------------------------------------------------- |
| Development | GET    | [https://devo.finnet.co.id/pg/payment/card/cancel/{orderId}](https://devo.finnet.co.id/pg/payment/card/cancel/%7BorderId%7D) |
| Production  | GET    | [https://live.finnet.co.id/pg/payment/card/cancel/{orderId}](https://live.finnet.co.id/pg/payment/card/cancel/%7BorderId%7D) |

### Data Request <a href="#data-request" id="data-request"></a>

| No | Name  | Type                                                          | Mandatory | Min Length | Max Length | Description     |
| -- | ----- | ------------------------------------------------------------- | --------- | ---------- | ---------- | --------------- |
| 1  | order | [Object](/api-reference/appendix/json-object/order-object.md) | M         | 1          | 12         | Detail of Order |

### Sample Request <a href="#sample-request" id="sample-request"></a>

```
{
    "order": {
        "id": "FK002502070000196",
        "amount": "22000"
    }
}
```

### Data Response <a href="#data-response" id="data-response"></a>

#### Sample Response <a href="#sample-response" id="sample-response"></a>

```
{
    "responseCode": "2000000",
    "responseMessage": "Request has been processed successfully",
    "processingTime": 0.24898290634155273,
    "traceId": "93a76615-a2c2-44fd-9dd3-1c0a22a6fe23"
}
```


---

# Agent Instructions: 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:

```
GET https://docs.finpay.id/api-reference/finpay-pg/after-payment/cancel-order.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
