Skip to main content
POST
Refund a transaction (partial or full)

Authorizations

Authorization
string
header
required

Same flow; ledger:write is required for any mutation.

Headers

Idempotency-Key
string

Required on writes. Stable identifier you choose. The same key always returns the same transaction, forever. Can also be supplied as idempotency_key in the request body. Header wins.

Allowed character set: A-Z, a-z, 0-9, _, :, ., -. Max 255 bytes. Replays of an accepted key return the original response with header Idempotent-Replayed: true so callers can tell a replay from a freshly-committed result.

Required string length: 1 - 255
Pattern: ^[A-Za-z0-9_:.\-]+$
Example:

"pi_acme_1234_capture"

Path Parameters

id
string<uuid>
required

Query Parameters

expand
enum<string>[]

Comma-separated. postings.account inlines each posting's account object; balances adds the post-commit balance of every touched account.

Available options:
postings.account,
balances

Body

application/json
amount
required

Refund amount in minor units. Accepts a positive decimal string (recommended) or an integer on write.

Pattern: ^\d+$
Example:

"5000000"

currency
string

The base currency to refund. Optional for single-currency originals (inferred). Required for multi-currency originals; omitting returns refund_currency_required (422).

Example:

"USDC"

idempotency_key
string

Optional body alternative to the Idempotency-Key header. Header wins.

metadata
object

Response

Idempotency replay (original refund returned)

object
enum<string>
required

Discriminator naming the shape of this resource (e.g. account, transaction).

Available options:
transaction
Example:

"account"

id
string<uuid>
required
Example:

"3061ec4e-c959-49ba-a0f6-99186a7bd5d8"

postings
object[]
required
idempotency_key
string
Example:

"pi_acme_1234_capture"

reverses
string<uuid> | null

Set when this transaction reverses another.

reversed_by
string<uuid> | null

Set when this transaction has been reversed.

refunds
string<uuid> | null

Set when this transaction refunds another (partial or full).

refund_amount
string | null

Minor units refunded, as a decimal string. Parse with a big-integer or decimal type, never a JS number. Present only on refund transactions.

Pattern: ^-?\d+$
exchange_rate
string | null

Decimal string. Present only when the transaction has postings in more than one currency. The rate that was in effect at write time. It is persisted for audit and restatement, never recomputed.

Example:

"1.0823"

base_currency
string | null

Currency that the exchange rate quotes from. Set with exchange_rate.

Example:

"USD"

quote_currency
string | null

Currency that the exchange rate quotes to. Set with exchange_rate.

Example:

"USDC"

metadata
object
Example:
balances
object[]

Returned only when ?expand=balances.

value_date
string<date-time>
booking_date
string<date-time>
created_at
string<date-time>
updated_at
string<date-time>