> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rebellapp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel

> Cancel a payment by paymentId or paymentRequestId.

`POST /v1/payments/cancel`

Cancels a payment when results are delayed or the merchant decides not to accept the order. Upon success, the full amount is refunded. At least one of `paymentId` or `paymentRequestId` must be provided — `paymentId` takes priority if both are given.

## Request Parameters

<ParamField body="paymentId" type="string">
  Unique ID assigned by the wallet to identify the payment.

  **Max length**: 64 characters
</ParamField>

<ParamField body="paymentRequestId" type="string">
  Unique ID assigned by the merchant to identify the payment request.

  **Max length**: 64 characters
</ParamField>

## Response Parameters

<ResponseField name="result" type="object" required>
  Standard result object with `resultCode`, `resultStatus`, `resultMessage`
</ResponseField>

<ResponseField name="paymentId" type="string">
  Wallet-assigned payment identifier.

  **Max length**: 64 characters
</ResponseField>

<ResponseField name="paymentRequestId" type="string">
  Merchant-assigned request identifier.

  **Max length**: 64 characters
</ResponseField>

<ResponseField name="cancelTime" type="string">
  Actual time when the cancellation completed, in ISO 8601 format.
</ResponseField>

## Result Codes

| resultStatus | resultCode                   | Description                               |
| ------------ | ---------------------------- | ----------------------------------------- |
| `S`          | `SUCCESS`                    | Cancellation successful                   |
| `F`          | `PARAM_ILLEGAL`              | Missing or invalid required parameter     |
| `F`          | `PROCESS_FAIL`               | General processing failure                |
| `F`          | `ORDER_STATUS_INVALID`       | Order status does not allow cancellation  |
| `F`          | `ORDER_HAS_BEEN_CAPTURED`    | Order has already been captured           |
| `F`          | `ORDER_HAS_BEEN_REFUNDED`    | Order has already been refunded           |
| `F`          | `ORDER_HAS_BEEN_VOIDED`      | Order has already been voided             |
| `F`          | `CANCEL_NOT_ALLOWED`         | Cancellation not permitted for this order |
| `F`          | `CANCEL_WINDOW_EXCEED`       | Cancellation period has expired           |
| `F`          | `ORDER_NOT_EXIST`            | Order does not exist                      |
| `F`          | `CLIENT_INVALID`             | Invalid client credentials                |
| `F`          | `INVALID_SIGNATURE`          | Signature invalid                         |
| `F`          | `METHOD_NOT_SUPPORTED`       | HTTP method not supported                 |
| `F`          | `MEDIA_TYPE_NOT_ACCEPTABLE`  | Unsupported media type                    |
| `F`          | `PARTNER_STATUS_ABNORMAL`    | Partner account status is abnormal        |
| `F`          | `PARTNER_BALANCE_NOT_ENOUGH` | Insufficient partner balance              |
| `U`          | `UNKNOWN_EXCEPTION`          | Unknown error occurred                    |
