Refunds
HTTP
POST /v1/payments/{paymentId}/refunds
Idempotency-Key: refund-1042-1
{ "amount": 2500, "reason": "Damaged item" }- Only a
succeededpayment can be refunded, through the processor that captured it. - The amount (minor units) is checked under a lock against what is still refundable: the captured amount minus
succeeded,
pendingandunknownrefunds (pending and unknown count as spent). Errors:422 refund_exceeds_refundable(withrefundable),422 refund_currency_mismatch,422 refund_non_positive,422 invalid_request("Only captured payments can be refunded"). GET /v1/payments/{id}/refundabletells you the remaining amount first.- A refund starts
pending; the processor's webhook or a status fetch makes itsucceededorfailed.unknownmeans the processor did not answer; GIEP reconciles it and it counts as spent meanwhile. Listen forrefund.succeeded/refund.failed. POST /v1/refunds/bulktakes up to 100 items, each with its ownkey, and reports a result per item.