POST
Refund a received return

Authorizations

Authorization
string
header
required

A secret API key. Publishable keys cannot reach this API. A key may carry an expiry, and an expired key is refused exactly like an unknown one, with a 401 that names no reason; check the key's expires_at in the dashboard rather than inferring it from a response. When a merchant rolls a key's secret they choose a grace window of up to 3 days, and for its duration BOTH the new secret and the one it replaced authenticate, so an integration moves over on its own deploy schedule instead of at the instant the button is pressed. Move before the window closes: after it, the old secret is refused. Nothing else about this contract moves with a roll. The key keeps its id and its scopes, so the only thing an integration updates is the credential itself.

Headers

Idempotency-Key
string
required

A unique key per logical write. Replaying a request with the same key returns the first response byte for byte instead of applying the write twice.

Path Parameters

returnId
string
required

Body

application/json

One route for two destinations. The amount is not here and cannot be: it was computed when the return was created, so this grant chooses whether to pay and never how much. Every spelling of an amount, and a customer_id, are refused by name. Only a received return can be refunded; anything else is a 409 naming the transition. A replayed Idempotency-Key returns the stored response without paying again, and a NEW key on an already-refunded return is a 409 rather than a second payout.

refund_to
enum<string>
required

REQUIRED with no default, because money out of the wrong door cannot be corrected by a second call. original_payment reverses the charge and lands any tender-funded remainder as store credit, since a card can only take back what it charged. store_credit credits the ORDER'S own customer; a guest order has nobody to credit and is a 409 rather than a silent fallback to the card.

Available options:
original_payment,
store_credit

Response

Success

data
object