> For the complete documentation index, see [llms.txt](https://pivot-payment.gitbook.io/pivot-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pivot-payment.gitbook.io/pivot-docs/api-references/api-lists/payments/payment-session/cancel-payment-session.md).

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