# Cancel Payment Session

## Method and URL

<mark style="color:green;">`POST`</mark> \[<mark style="color:orange;">BASE\_URL</mark>]/v2/payments/{id}/cancel

<mark style="color:orange;">`id`</mark> from the Payment Session ID whenever you create Payment Session

{% hint style="info" %}
Cancellation can be done if the Payment Session status is <mark style="color:orange;">`REQUIRE_CONFIRMATION`</mark> or <mark style="color:orange;">`REQUIRE_PAYMENT_METHOD`</mark>&#x20;
{% endhint %}

## Request

**Request Body**

```json
{
  "cancellationReason": "REQUESTED_BY_CUSTOMER"
}
```

**Detail Parameter Request**

<table><thead><tr><th>Parameter</th><th width="127.6884765625">Data Type</th><th width="139.7060546875">Requirement</th><th>Description</th></tr></thead><tbody><tr><td>cancellationReason</td><td>String</td><td>M</td><td>Reason to cancel Payment Session</td></tr></tbody></table>

## Response

**Response Body**

```json
{
  "code": "00",
  "message": "Success",
  "data": {
    "id": "f5011fb2-e205-46ad-ac20-481429ba1d32",
    "clientReferenceId": "1743343932",
    "amount": {
      "value": 10000,
      "currency": "IDR"
    },
    "autoConfirm": false,
    "mode": "REDIRECT",
    "redirectUrl": {
      "successReturnUrl": "https://merchant.com/success",
      "failureReturnUrl": "https://merchant.com/failure",
      "expirationReturnUrl": "https://merchant.com/expiration"
    },
    "paymentType": "SINGLE",
    "paymentMethod": null,
    "statementDescriptor": "Reforza Pivot",
    "saveForFutureUse": false,
    "showSavedPayment": false,
    "expirationMode": "LOOSE",
    "status": "CANCELLED",
    "createdAt": "2025-03-30T14:12:12Z",
    "updatedAt": "2025-03-30T14:12:28.231875669Z",
    "expiryAt": "2025-03-30T14:12:28.231875669Z",
    "paymentUrl": "https://payment.pivot-payment.com/detail?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1dWlkIjoiZjUwMTFmYjItZTIwNS00NmFkLWFjMjAtNDgxNDI5YmExZDMyIiwiaXNzIjoiYmFja2VuZC1wb3J0YWwiLCJleHAiOjE3NDM0NjU1NDV9.DsupgNf0F-IfinTSvQd_2Y6iEIrk8Mr7WcNGATGtYqs",
    "chargeDetails": null,
    "cancelledAt": "2025-03-30T14:12:28.231875669Z",
    "cancellationReason": "REQUESTED_BY_CUSTOMER",
    "metadata": {
      "invoiceNo": "INV001"
    },
    "bypassStatusPage": false
  }
}
```

**Detail Parameter Response**

<table><thead><tr><th width="208.9453125">Parameter</th><th width="111.5390625">Data Type</th><th width="132.98828125">Requirement</th><th>Description</th></tr></thead><tbody><tr><td>Payment Session</td><td>Object</td><td>M</td><td><a data-mention href="/pages/mqeyX8IibhoTYbcrM9PI">/pages/mqeyX8IibhoTYbcrM9PI</a></td></tr></tbody></table>


---

# 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://pivot-payment.gitbook.io/pivot-docs/api-references/api-lists/payments/payment-session/cancel-payment-session.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.
