# Refunds

> Refund an approved payment in full or in part.

Refund a payment that is `approved` or `partially_refunded`. The money goes back to the customer through the same provider, in the payment's currency.

## Create a refund

Send an `amount` for a partial refund, or leave it out to refund everything left:

**cURL**

```bash
curl -X POST https://api.camelpayment.com/v1/payments/pay_01JBX7Q2M4N8K5R6T9V3W1Y0ZA/refunds \
  -H "Authorization: Bearer $CAMEL_API_KEY" \
  -H "Idempotency-Key: refund-1524-1" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 500000
  }'
```

**Node.js**

```javascript
const response = await fetch('https://api.camelpayment.com/v1/payments/pay_01JBX7Q2M4N8K5R6T9V3W1Y0ZA/refunds', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CAMEL_API_KEY}`,
    'Idempotency-Key': 'refund-1524-1',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "amount": 500000
  })
});
const data = await response.json();
```

**Python**

```python
import os
import requests

response = requests.post(
    "https://api.camelpayment.com/v1/payments/pay_01JBX7Q2M4N8K5R6T9V3W1Y0ZA/refunds",
    headers={
        "Authorization": f"Bearer {os.environ['CAMEL_API_KEY']}",
        "Idempotency-Key": "refund-1524-1",
    },
    json={
        "amount": 500000
    },
)
data = response.json()
```

**201 Created**

```json
{
  "id": "ref_01JBX8A1B2C3D4E5F6G7H8J9KM",
  "payment_id": "pay_01JBX7Q2M4N8K5R6T9V3W1Y0ZA",
  "provider_refund_id": "987654321",
  "amount": 500000,
  "currency": "ARS",
  "status": "approved",
  "provider_status": "approved",
  "failure_code": null,
  "created_at": "2026-11-12T16:10:00Z",
  "updated_at": "2026-11-12T16:10:02Z"
}
```

## Partial refunds

You can refund a payment several times, until the refunds add up to the payment amount. Refunds still pending count too, so two refunds sent at the same moment can't exceed the payment; the second one returns `409`. The payment becomes `partially_refunded`, then `refunded`.

## Refund statuses

| Status | Meaning |
| --- | --- |
| `pending` | The provider is processing it. |
| `approved` | The money is on its way back to the customer. |
| `rejected` | The provider refused the refund. |
| `failed` | The provider returned an error. `failure_code` says which. |
| `unknown` | The provider's answer was lost. Don't refund again with a new key. |

Camel sends a `refund.*` webhook each time a refund changes. To list a payment's refunds, see [List refunds](https://camelpayment.com/docs/api-reference/list-refunds.md).
