API Reference
Refund a payment
Refunds a payment. Omit amount (or send an empty body) for a full refund
of the remaining balance; pass amount (minor units) for a partial refund.
Authorization
apiKey AuthorizationBearer <token>
A secret API key, e.g. Authorization: Bearer sk_test_....
In: header
Path Parameters
id*string
Payment id (pay_...).
Header Parameters
Idempotency-Key?string
A client-chosen key that makes this POST safe to retry. Replaying the same
key returns the original response. A different body with the same key
returns 422 idempotency_key_reuse; an in-flight key returns
409 idempotency_conflict.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/v1/payments/string/refunds" \ -H "Content-Type: application/json" \ -d '{ "amount": 2500, "reason": "customer_request" }'{ "payment_id": "string", "refunded": 0, "status": "partially_refunded", "connector_ref": "string", "refund_status": "string"}{ "error": { "code": "invalid_body", "message": "invalid request body" }}{ "error": { "code": "feature_disabled", "message": "refunds are disabled" }}{ "error": { "code": "not_found", "message": "not found" }}{ "error": { "code": "not_refundable", "message": "payment is not refundable" }}{ "error": { "code": "amount_too_large", "message": "amount exceeds refundable balance" }}{ "error": { "code": "connector_error", "message": "connector request failed" }}