Skip to main content
POST
Create a refund
Authenticate with an API key that belongs to the target organization and has Full access or the sales:refunds:execute permission. Only the Owner, Admin and Finance roles can grant it.
  • Refunds through the API work only after Anyway has enabled them for your organization; contact Anyway support to turn it on. Until then a refund on one of your orders returns 403 REFUND_API_NOT_ENABLED, whatever the key. Order errors, such as 404 for an unknown order, come first.
  • Takes the same inputs as the Refund button on an order in the dashboard. Omit amountCents to refund everything still refundable. reason is optional: duplicate, fraudulent or requested_by_customer. The currency is always the order’s.
  • Send a unique Idempotency-Key header (required; 1–200 ASCII characters from 0x21 to 0x7E, no spaces). The same key with the same body returns the same refund and never refunds twice. The same key with a different order, amount or reason returns 409.
  • Card orders up to 90 days old only. Contact Anyway support for older orders.
  • 200 with status succeeded means the refund is done. 202 with status pending means it waits for Anyway’s review or for the card network. Review applies when the refund brings the order’s total refunded to the approval threshold or above, or takes your organization past its daily refund limit (shared with dashboard refunds); only one refund per order can wait for review at a time. Retry with the same Idempotency-Key to get its current state, or wait for the refund.succeeded or refund.failed Webhook.
  • The response is the same refund object as Get a refund. API refunds also show on the order in the dashboard.

Authorizations

X-API-Key
string
header
required

Merchant API key (format: ak_BASE64)

Headers

Idempotency-Key
string
required

Unique creation request key: 1-200 ASCII characters in the range 0x21-0x7E (no spaces or control characters)

Required string length: 1 - 200

Body

application/json

Order and amount

orderId
string
required

The order to refund (ORD...). Card orders only.

amountCents
integer

Amount to refund, in the order's currency. Omit to refund everything still refundable.

reason
enum<string>

Optional reason

Available options:
duplicate,
fraudulent,
requested_by_customer

Response

OK. The refund succeeded, or an earlier request with this Idempotency-Key is returned.

data
object
error
object
message
string
success
boolean