# Record an offline refund

URL: /docs/api/merchant/orders/record-an-offline-refund

## POST /v1/merchant/orders/{reference}/offline-refund

```http
POST https://api.elaraone.app/api/v1/merchant/orders/{reference}/offline-refund
```

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `reference` | path | string | yes |  |
| `X-Client-IP` | header | string |  | Optional. IP address of the shopper (one IPv4/IPv6, no port, no list). Honoured only together with a valid X-Tenant-Secret; ignored otherwise. Used for rate limits and recorded with form submissions. |
| `X-Tenant-Secret` | header | string |  | Optional here. Server secret of the store: server-to-server only, never from a browser. Enables X-Client-IP. |
| `Idempotency-Key` | header | string |  | Optional; recommended (a UUID made once per user action, reused only to retry that action). Only a success is stored (24 hours): the same key with the same body, URI and credentials (Authorization, X-Cart-Token, X-Chat-Token) replays it (`Idempotent-Replayed: true`); anything else under that key is 422 `IDEMPOTENCY_KEY_REUSED`. An error is never stored: after a 4xx or 5xx, retrying with the same key runs the request again. |

### Request body (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `amount` | integer (nullable) |  |  |
| `reference` | string (nullable) |  |  |
| `note` | string (nullable) |  |  |
| `lines` | object[] |  | The goods units this refund gives back, so ad-platform conversions are restated exactly. Omitted = an amount-only refund (restated proportionally). |

### Responses

- **200**: Success.
- **401**: Unauthenticated
- **402**: Payment required. Branch on `error.code`: - `TENANT_PAYMENT_REQUIRED`: this store is on payment hold. Show a "store temporarily unavailable" page; do not retry the request.
- **403**: Authorization error
- **404**: Not found: `FEATURE_NOT_ENABLED` when this store does not have the Shop feature on.
- **409**: `IDEMPOTENCY_IN_PROGRESS`: a request with this Idempotency-Key is still being processed; retry shortly with the same key.
- **422**: Validation error Also 422 `IDEMPOTENCY_KEY_REUSED`: this Idempotency-Key already belongs to a different request (body, URI or credentials).