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

# Cancel Payment

> Cancel a pre-authorized payment and release the reserved funds.

This endpoint cancels a pre-authorized payment and releases the reserved funds back to the customer's payment method. Use this when you decide not to capture the reserved funds.

<Warning>
  A pre-authorized payment can only be cancelled if it has not already been confirmed or cancelled.
</Warning>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST 'https://developers.flouci.com/api/v2/cancel_payment' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer <PUBLIC_KEY>:<PRIVATE_KEY>' \
    -d '{
      "payment_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef"
    }'
  ```
</RequestExample>

### Body

<ParamField body="payment_id" type="string" required>
  The ID of the pre-authorized payment to cancel.
</ParamField>

<ResponseExample>
  ```json Success theme={null}
  {
    "result": {
      "payment_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
      "status": "cancelled",
      "cancelled_at": "2025-01-15T10:30:00Z"
    },
    "status": "success"
  }
  ```

  ```json Error theme={null}
  {
    "status": "error",
    "message": "Pre-auth payment cannot be cancelled",
    "code": "CANCELLATION_FAILED"
  }
  ```
</ResponseExample>
