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

# Refund a payment

> Send money back to a customer for a successful payment, in full or in part.

A refund goes back to the number that paid. You need a **full secret key**; payments-only keys can't refund.

**1. Check what can be refunded**

Call `GET /v1/payments/{reference}/refunds`. The response lists earlier refunds and `refundable`, the amount still left.

**2. Create the refund**

Call `POST /v1/payments/{reference}/refunds` with an `Idempotency-Key` header, so a retry never refunds twice.

```json theme={null}
{ "amount": 5000, "reason": "Order cancelled" }
```

Leave out `amount` to refund everything still refundable.

**3. Follow it to the end**

The refund starts as `processing`. Check it with `GET /v1/refunds/{reference}` until it is `success` or `failed`. If it fails, the money goes back to your balance and you can try again.

## Good to know

* The refund is taken from the payment's money that hasn't settled yet, then from your available balance. If neither covers it, you get `insufficient_funds`.
* PrimePay's fee on the original payment isn't returned.
* You can make several partial refunds until they add up to the payment's amount.

See [refund errors](https://docs.primepay.mw/api-reference/payments-overview.md#refund-errors) for every code.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.