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

# Cancellations & Refunds

> Cancel pending intents and refund completed payments.

### Cancel a Pending Intent

**`POST /merchant/api/v1/payment-intents/{id}/cancel`**

Only intents in `pending` status can be cancelled. Returns `200` on success.

***

### Issue a Refund

**`POST /merchant/api/v1/payment-intents/{id}/refund`**

Only intents in `completed` status can be refunded. The full amount is returned to the customer's wallet.

**Response:**

```json theme={null}
{
  "success": true,
  "refund_initiated": true,
  "message": "Refund initiated successfully. Funds will be returned to the customer's wallet.",
  "payment_intent": {
    "id": "pi_xxxx",
    "status": "refunded",
    "refund_status": "initiated",
    "refund_ledger_tx_id": "ltx_zzzz"
  }
}
```
