> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.paywithatoa.co.uk/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel Payment | Payments API

> Cancel payment via the Atoa Payments API, request parameters, response schema and code samples in cURL, Python, JavaScript, PHP, Go and Java.

The Cancel Payment API facilitates the quick cancellation of a payment request. Simply pass the paymentRequestId obtained during payment generation.

<Note>
  The payment can be cancelled if the status of the payment request is in PAYMENT\_NOT\_INITIATED or AWAITING\_AUTHORIZATION.
</Note>

### Authorization

Bearer `<token>`

**Request Body Schema**

<ParamField path="paymentRequestId" type="string" required>
  The paymentRequestId of the initiated payment which you’ll receive from
  process-payment API
</ParamField>

<ResponseExample>
  ```json 200 theme={null}
  {
    "message": "Your payment has been cancelled successfully."
  }
  ```

  ```json 400 theme={null}
  {
    "name": "BAD_REQUEST",
    "message": "Your payment has already been processed and can't be cancelled. Please contact us if you need any help.",
    "status": 400,
    "errors": "[]"
  }
  ```

  ```json 401 theme={null}
  {
    "name": "UNAUTHORIZED",
    "message": "Unauthorized",
    "status": 401,
    "errors": "[]"
  }
  ```
</ResponseExample>

**Response**

<ResponseField name="message" type="string">
  Your payment has been cancelled successfully.
</ResponseField>
