# Refunds

> Money back, whole or part, one refund at a time, and what to do when the answer is unknown

Source: https://rcms-tickets-test.web.app/docs/refunds

A refund returns money on an order, and voids the tickets it covers. You can refund the whole order, an amount, or named tickets and add-ons (their share of fees and tax goes with them).

## Look first

Send `dry_run: true`. The answer is the refund it would make, with its lines, fees, tax and which payments it goes back to, and nothing changes. Do this before every refund an agent makes.

```ts
const preview = await tickets.refunds.create({ order: order.id, amount: 1000, dry_run: true });
console.log(preview.object, preview.amount.amount); // refund_preview 1000
```

## Make the refund

```ts
const refund = await tickets.refunds.create({ order: order.id, amount: 1000, reason: 'requested_by_customer' });
if (refund.object !== 'refund') throw new Error('expected a refund');
console.log(refund.status, refund.amount.amount); // succeeded 1000

const after = await tickets.orders.retrieve(order.id);
console.log(after.status, after.amount_refunded.amount, after.amount_refundable.amount); // partially_refunded 1000 10000
```

- A refund cannot be more than `amount_refundable` (`refund_exceeds_remaining`).
- `reason` is one of `requested_by_customer`, `event_cancelled`, `event_postponed`, `duplicate`, `fraudulent`, `exchange`, `other`.
- It is `pending` until the payment provider answers. A refund of an `external` payment is recorded at once, and **you** return the money with your own processor: the refund's `recorded_only` says so.
- A refund of a comp only voids its tickets.
- A disputed order cannot be refunded until the dispute closes.

## The platform fee on a refund

If the platform charges you a fee, a refund gives back its share on that sale: in proportion to the money refunded of the payment, so a whole refund gives back all of it and the last of several refunds ends exactly on the fee. A part, an amount or a ticket refund work the same way. Refund protection you keep, or give back, is just money kept or refunded: it never bore the fee, and the share is over the whole payment. Each share is worked out by us; Square's own rounding may differ by a cent per refund until proven. A lost chargeback gives back none: assumed until proven in Square's sandbox (Square's page says that when the seller is liable for the whole amount, "you keep your portion of the payment"). The statement's `platform_fee` says what was kept at each step. Nothing about the fee changes what the buyer is refunded.

## One refund at a time

Only one refund of an order can be on its way at a time. While one is `pending`, a new refund, or its dry run, is refused with `order_not_refundable`. That answer is kept under its `Idempotency-Key` for 24 hours, so **try again with a new key** once the first refund has ended. Reading the order or the refund tells you where it stands: `GET /v1/refunds?order=ord_…`.

While a pending refund names a ticket, or is all the money left, that ticket can't change hands: a transfer or a direct move is refused with `refund_pending`, and an offer already open can't be accepted until the refund ends. Paid, the ticket voids and the offer with it. Failed, the offer can be accepted again.

A holder's day swap waits for any pending refund on the order, whichever tickets it names: the page doesn't offer it, and the API answers `refund_pending` to the buyer and `transfer_on_hold` to anyone else.

## When the answer is unknown

A `503 outcome_unknown` on a refund means the refund **may have started**. Do not make another one under a new `Idempotency-Key`: that is how a buyer is refunded twice. Do one of these:

1. Read the order's refunds (`GET /v1/refunds?order=ord_…`). If a refund of that amount is there, it started.
2. Or send the same request again with the same `Idempotency-Key`. You get the first answer, or the refund is made once.

A same-key retry of a refund the provider refused answers `payment_failed`. A refund still `pending` after 14 days raises an alert to the operator.

## Through the MCP server

The `create_refund` tool asks first: called without a `confirmation` it only previews, and answers a token to send back with the same arguments. See [the MCP server](https://rcms-tickets-test.web.app/docs/mcp.md), and what a confirmation is and is not.
