# Refunds

Request money back for a succeeded payment, in full or in part.

A refund is a request: K-LINK processes the refund to the payer, then marks it done. Every refund is created with status `manual` and sends `refund.pending`. When K-LINK has refunded the payer it becomes `succeeded` and you receive `refund.succeeded`. Refunds are not instant, in live or test mode.

The amount is deducted from your next [payout](/api/payouts.md) from the moment the refund is requested, so it can't be paid out to you as well. If refunds are more than the payout, the rest carries over to later payouts.

## The refund object

| Field | Type | Description |
|---|---|---|
| `id` | string | Starts with `rf_`. |
| `object` | string | Always `refund`. |
| `livemode` | boolean | Test or live mode. |
| `payment` | string | The id of the refunded payment. |
| `amount` | integer | Refunded amount in the smallest currency unit. |
| `currency` | string | Same as the payment. |
| `status` | enum | `manual` (requested; K-LINK is processing the refund to the payer), then `succeeded` once K-LINK has refunded the payer, or `failed`. `pending` is part of the enum but new refunds start as `manual`. |
| `reason` | string \| null | Your note on why. |
| `created_at` | timestamp | When the refund was created. |

```json title="A refund"
{
  "id": "rf_8Hk2Lm4Np6Qr8St0Uv2Wx4",
  "object": "refund",
  "livemode": false,
  "payment": "pay_4Nq7xY2mKc8vTz1aB3dE9f",
  "amount": 5000,
  "currency": "MMK",
  "status": "manual",
  "reason": "Customer returned one item",
  "created_at": "2026-11-27T11:00:00Z"
}
```

## Create a refund

```http
POST /v1/refunds
```

**Body**

| Field | Type | Required | Description |
|---|---|---|---|
| `payment` | string | yes | Id of a `succeeded` payment. |
| `amount` | integer | no | Defaults to what is left to refund. Can't exceed `amount − amount_refunded`. |
| `reason` | string | no | Free text. |

Returns the refund with status `manual` and sends `refund.pending`. Requires `refunds:write` on restricted keys. Refunding a payment that hasn't succeeded, or more than is left, returns `409 invalid_state` or `400 invalid_request`.

```bash title="Request"
curl https://api.klinkpay.net/v1/refunds \
  -X POST \
  -H "Authorization: Bearer kp_test_…" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "payment": "pay_4Nq7xY2mKc8vTz1aB3dE9f",
    "amount": 5000,
    "reason": "Customer returned one item"
  }'
```

```json title="Response"
{
  "id": "rf_8Hk2Lm4Np6Qr8St0Uv2Wx4",
  "object": "refund",
  "livemode": false,
  "payment": "pay_4Nq7xY2mKc8vTz1aB3dE9f",
  "amount": 5000,
  "currency": "MMK",
  "status": "manual",
  "reason": "Customer returned one item",
  "created_at": "2026-11-27T11:00:00Z"
}
```

## Retrieve a refund

```http
GET /v1/refunds/:id
```

Returns the refund.

```bash title="Request"
curl https://api.klinkpay.net/v1/refunds/rf_8Hk2Lm4Np6Qr8St0Uv2Wx4 \
  -H "Authorization: Bearer kp_test_…"
```

## List refunds

```http
GET /v1/refunds
```

**Query**

| Field | Type | Description |
|---|---|---|
| `payment` | string | Only refunds of this payment. |
| `limit, starting_after, ending_before` |  | See [Pagination](/concepts/pagination.md). |

```bash title="Request"
curl https://api.klinkpay.net/v1/refunds?payment=pay_4Nq7xY2mKc8vTz1aB3dE9f \
  -H "Authorization: Bearer kp_test_…"
```

```json title="Response"
{
  "object": "list",
  "data": [
    {
      "id": "rf_8Hk2Lm4Np6Qr8St0Uv2Wx4",
      "object": "refund",
      "livemode": false,
      "payment": "pay_4Nq7xY2mKc8vTz1aB3dE9f",
      "amount": 5000,
      "currency": "MMK",
      "status": "manual",
      "reason": "Customer returned one item",
      "created_at": "2026-11-27T11:00:00Z"
    }
  ],
  "has_more": false
}
```

> [!NOTE]
> Refund events: `refund.pending` when the refund is requested, `refund.succeeded` when K-LINK has refunded the payer, `refund.failed` if it could not be completed. Wait for `refund.succeeded` before telling the customer the money is back.
