# Refund a payment (/docs/api/refunds/create-refund)

## Refund a payment

`POST https://runepay.co/api/v1/refunds`

Omit `amount` for a full refund of what is left.

Scope: `refunds:write`

| Parameter | In | Type | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | header | string | Makes a retry safe: the same key and body within 24 hours does not repeat the request. |

Body:

| Field | Type | Description |
| --- | --- | --- |
| `payment` (required) | string | The payment to refund. |
| `amount` | integer | Amount in minor units. Defaults to the whole refundable amount. |
| `reason` | string or null | Your reason, kept on the refund. |

Example request body:

```json
{
  "payment": "pay_01KA4Y0Z9V3T6N8Q2W5E7R1T3Y",
  "amount": 500,
  "reason": "requested_by_customer"
}
```

Response `201`:

```json
{
  "id": "re_01KA5B2C4D6E8F0G2H4J6K8M0N",
  "object": "refund",
  "livemode": false,
  "payment": "pay_01KA4Y0Z9V3T6N8Q2W5E7R1T3Y",
  "amount": 500,
  "currency": "USD",
  "status": "succeeded",
  "reason": "requested_by_customer",
  "failure_reason": null,
  "created": 1767312000
}
```

Errors: 400, 401, 403, 404, 409, 413, 422, 500, 503, with the [error shape](/docs/api/errors).
