---
search:
  tags:
    - Payments
    - POST
seo:
  description: >-
    Cancels a pending payment. A payment that has already succeeded or failed…
    Reference for the POST /payments/{paymentId}/cancel endpoint in the Apipay
    API.
sidebar:
  label: Cancel a payment
  badge: POST
title: Cancel a payment
type: openapi-operation
---
Cancels a `pending` payment. A payment that has already succeeded or failed can't be canceled.

`POST /payments/{paymentId}/cancel`

**Responses**

- `200` — The canceled payment.
- `401` — The API key is missing, invalid, or revoked.
- `404` — No resource exists with that identifier.
- `409` — The payment can't be canceled from its current status.

Response example, 200:

```json
{
  "id": "pay_6b2f9d4e",
  "amount": 150000,
  "currency": "IDR",
  "method": "qris",
  "status": "pending",
  "customer_id": "cus_8f3a2b1c",
  "description": "Order",
  "created_at": "2019-08-24T14:15:22Z"
}
```
