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

# Refunds

> Refund all or part of a Checkout payment from your server.

`POST /v1/refunds` returns money to the customer for a Checkout payment: a website session, a payment link, or a subscription charge. Refund the whole payment or just part of it, more than once, until nothing is left.

> [!NOTE]
>
> **Scope:** `refunds.write` to create, `checkout.read` to list
>
> The Easner fee on the payment is not returned when you refund. Refunds go back to the customer's original payment method. A bank debit refund can stay `pending` for a few days.
>
> You can refund through the API until the payment has been credited to your Easner balance. After that the call returns `409 already_settled` and support does the refund.

## Create a refund

Identify the payment with `checkout_session` (the `cs_…` id you already store) or with `payment` (the payment id in `refund.*` and `dispute.*` webhooks). Send one of them. If you send both, `payment` wins when it is a UUID; otherwise `checkout_session` is used. A `payment` that is not a UUID is ignored, and with no usable value the call is `404` `payment_not_found`.

```bash curl theme={null}
curl https://api.easner.com/v1/refunds \
  -H "Authorization: Bearer $EASNER_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: refund-ord_1042-1" \
  -d '{
    "checkout_session": "cs_test_a1B2c3…",
    "amount": 2500,
    "reason": "requested_by_customer"
  }'
```

```js Node theme={null}
const response = await fetch("https://api.easner.com/v1/refunds", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.EASNER_SECRET_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": `refund-${orderId}-1`,
  },
  body: JSON.stringify({
    checkout_session: sessionId,
    amount: 2500,
    reason: "requested_by_customer",
  }),
});
const refund = await response.json();
```

```python Python theme={null}
import os
import requests

response = requests.post(
    "https://api.easner.com/v1/refunds",
    headers={
        "Authorization": f"Bearer {os.environ['EASNER_SECRET_KEY']}",
        "Idempotency-Key": f"refund-{order_id}-1",
    },
    json={
        "checkout_session": session_id,
        "amount": 2500,
        "reason": "requested_by_customer",
    },
    timeout=30,
)
refund = response.json()
```

```php PHP theme={null}
<?php
$ch = curl_init("https://api.easner.com/v1/refunds");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("EASNER_SECRET_KEY"),
        "Content-Type: application/json",
        "Idempotency-Key: refund-" . $orderId . "-1",
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "checkout_session" => $sessionId,
        "amount" => 2500,
        "reason" => "requested_by_customer",
    ]),
]);
$refund = json_decode(curl_exec($ch), true);
```

```ruby Ruby theme={null}
require "net/http"
require "json"

uri = URI("https://api.easner.com/v1/refunds")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch('EASNER_SECRET_KEY')}"
request["Content-Type"] = "application/json"
request["Idempotency-Key"] = "refund-#{order_id}-1"
request.body = { checkout_session: session_id, amount: 2500, reason: "requested_by_customer" }.to_json

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(request) }
refund = JSON.parse(response.body)
```

Response, `201`:

```json theme={null}
{
  "object": "refund",
  "id": "re_3Q1x…",
  "payment": "7c1e9f0a-52b4-4a8e-9d3f-1b6a2c4e8d70",
  "amount": 2500,
  "currency": "USD",
  "status": "succeeded",
  "reason": "requested_by_customer",
  "amount_refunded_total": 2500,
  "fully_refunded": false,
  "livemode": false
}
```

The request and response fields are on [Create a refund](https://docs.easner.com/api-reference/refunds/create-a-refund.md). That page is the contract. Send `checkout_session` (the `cs_…` you store) unless you only have the payment id from a `refund.*` or `dispute.*` webhook. Omit `amount` to refund everything still left. `reason` is `requested_by_customer`, `duplicate` or `fraudulent`.

Response `status` is `succeeded` or `pending` (bank debits). `amount_refunded_total` is the sum refunded on this payment so far. `fully_refunded` is `true` once nothing is left.

`amount` is rounded to the nearest whole cent before it is used (`25.5` becomes `26`, a numeric string such as `"2500"` is read as a number). Anything that rounds to zero or below, or is not a number, is `400` `invalid_amount`. Send whole cents and you will never see this. `reason` in the response is the value you sent, or `null`; it is not stored as a label for the customer.

## Ids

A refund has one id everywhere: the provider refund id (`re_…`).

| Where | `id` is | Example |
| - | - | - |
| `POST /v1/refunds` response | The provider refund id | `re_3Q1x…` |
| `GET /v1/refunds` list, each `data[].id` | The same provider refund id | `re_3Q1x…` |
| `refund.created`, `refund.updated`, `refund.failed` webhooks (`refund_id`) | The same provider refund id | `re_3Q1x…` |

Match a list row to a POST response or a webhook by `id`. A refund that has no provider id yet (a `pending` row that never reached the provider) is listed with Easner's internal row id (a UUID) until it has one. `payment` is the same UUID everywhere: the `payment` field here and `payment_id` in webhooks.

## Partial refunds

Send a smaller `amount` each time. Each call is its own refund. Easner stops you at the remaining balance with `400 amount_too_large`, and with `409 already_refunded` once the payment is fully refunded.

```bash theme={null}
# Refund $25.00 now, then the remaining $88.00 later by omitting amount
curl https://api.easner.com/v1/refunds \
  -H "Authorization: Bearer $EASNER_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: refund-ord_1042-2" \
  -d '{ "checkout_session": "cs_test_a1B2c3…" }'
```

Use a different `Idempotency-Key` for each refund you intend to make. Easner computes the amount at the time of the call: an omitted `amount` refunds whatever is left then.

## List refunds

`GET /v1/refunds?checkout_session=cs_…` (or `?payment=…`) lists the refunds on one payment, **oldest first**. It includes refunds that are `pending`, `failed` or `canceled`, and refunds made in Console or by the payment provider. A `GET` with neither parameter is `400` `invalid_request` (`fields` names `payment`). A value that matches nothing in this mode is `404` `payment_not_found`. There is no refund list across payments and no retrieve by id.

```bash theme={null}
curl "https://api.easner.com/v1/refunds?checkout_session=cs_test_a1B2c3…" \
  -H "Authorization: Bearer $EASNER_SECRET_KEY"
```

```json theme={null}
{
  "object": "list",
  "data": [
    {
      "object": "refund",
      "id": "re_3Q1x…",
      "payment": "7c1e9f0a-52b4-4a8e-9d3f-1b6a2c4e8d70",
      "amount": 2500,
      "currency": "USD",
      "status": "succeeded",
      "reason": "requested_by_customer",
      "created_at": "2026-10-09T10:20:00.000Z"
    }
  ]
}
```

## Idempotency

`Idempotency-Key` makes a retry return the refund it already made, never a second one. A replay returns `201` (not `200`) with the original `id`, `amount` and `status` as they were stored, and `amount_refunded_total` as it is now. A replay still answers even if nothing is left to refund. The same key with a different payment, or a different `amount` when you send one, is `409 idempotency_mismatch`; a different `reason` is not compared. Keys are scoped to your business. See [Authentication](https://docs.easner.com/authentication.md#idempotency).

## Errors

| Status | `code` | When |
| - | - | - |
| 400 | `invalid_request` | The body is not JSON |
| 400 | `invalid_amount` | `amount` is zero, negative or not a number |
| 400 | `invalid_reason` | `reason` is not one of the three values |
| 400 | `amount_too_large` | `amount` is more than what is left to refund |
| 404 | `payment_not_found` | No paid payment matches `payment` or `checkout_session` in this mode |
| 409 | `already_refunded` | Nothing is left to refund |
| 409 | `already_settled` | The money already reached your Easner balance. Contact support to refund it |
| 409 | `idempotency_mismatch` | The key was used for a different refund |
| 502 | `refund_failed` | The refund did not go through. Retry with the same key |

Full list: [Errors](https://docs.easner.com/errors.md).

## Events

`refund.created`, `refund.updated` and `refund.failed` are sent to your webhook, including refunds you make in Console. Dedupe on `refund_id` plus `status`. `refund_id` is the `re_…` id from the POST response and the list. Every refund event carries `payment_id` and `fully_refunded`. See [Webhooks](https://docs.easner.com/webhooks.md#refunds) and [Webhook events](https://docs.easner.com/webhook-events.md#refunds).

## Test and live

A test key refunds test payments. A live key refunds live payments. A payment from the other mode is `404 payment_not_found`.

> [card] [Customer portal](https://docs.easner.com/customer-portal.md)
>
> Let customers see receipts and refunds themselves.


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