Credits
Refund a credit charge
Gives a charge back to its credit account. The paywall middleware calls this when the request a charge paid for failed (your handler threw or answered 400 or higher). A charge can be refunded once; a second refund returns 409 with type invalid_state.
Rate limit: 600 per minute per API key, counted separately from charges.
bearerAuthAuthorizationBearer <token>A live API key, sk_live_ followed by 32 base58 characters.
id*stringThe charge id (cru_…) returned by the charge.
Idempotency-Key?stringA unique string of 1 to 255 characters for this operation. A key belongs to the business across every endpoint for 24 hours, so give each operation its own key, for example invoice-order-1042 and refund-order-1042, not the order id alone. A retry with the same key on the same endpoint and with the same body returns the stored response with the header Idempotent-Replayed: true. The same key with a different body or on another endpoint returns 409 idempotency_conflict. Errors are not stored, so a request that failed can be retried with the same key, even with a corrected body. While the first request with a key is still running, a retry gets 409 idempotency_conflict with Retry-After: 1.
1 <= length <= 255The refunded charge, with the balance after the refund.
application/json- response
id*stringCharge id, starting with cru_; pass it to the refund endpoint to give the charge back.
object*stringamount*stringAmount charged in USD with 6 decimals.
refunded?booleanPresent and true on the refund endpoint's answer.
balance*stringBalance in USD with 6 decimals after this charge or refund.
currency*stringcurl -X POST 'https://example.com/api/v1/credits/charges/string/refund'{ "id": "string", "object": "credit_charge", "amount": "string", "refunded": true, "balance": "string", "currency": "USD"}