Create Refund
Create a refund for a payment intent or an invoice.
By payment_intent_id, the refund reverses the latest succeeded charge. By
invoice_id, it reverses the charge that settled the invoice — and when that
invoice has no cash left to reverse (settled entirely from customer credit, or
its cash already fully refunded) it returns the credit still applied to the
invoice instead: the refund then has charge_id null, amount_atom 0 and
the value in credit_restored_atom.
Authentication
Bearer authentication of the form Bearer <token>, where token is your auth token.
Path parameters
Headers
Request
ID of the payment intent to refund. The API auto-resolves the latest succeeded processor attempt.
ID of the invoice to refund. The API resolves the payment allocation and auto-resolves the succeeded processor attempt. Errors if the invoice was paid by multiple payment intents. An invoice settled entirely from customer credit, or whose cash has already been fully refunded, is refunded as credit alone: the refund has charge_id null and amount_atom 0, and credit_restored_atom carries what went back to the customer’s balance.
Total value to return, in atoms — filled cash first. For an invoice settled partly from customer credit this covers both legs: the excess over the cash leg comes back as credit (see credit_restored_atom on the response). If not provided, the full refundable cash on the charge, and nothing else: once that cash is gone an omitted amount is refused (RFR14), and the credit still applied comes back only for a stated amount. An invoice settled entirely from credit has no charge, so there an omitted amount returns all the credit still applied.
Additional metadata (max 10KB when serialized)
Set to true if refund was already processed externally (e.g., in Stripe dashboard). This records the refund without calling the payment processor.
Response
Cash refunded in atoms — what was reversed at the payment processor. For an invoice settled partly from customer credit this is the cash leg only; see credit_restored_atom for the rest. 0 for a refund that returned credit only.
Customer credit returned to the balance by this refund, in atoms. Non-zero only when the invoice was settled partly from credit and the refund asked for more than its cash leg: refunds draw the cash down first, and the excess comes back as credit. Sum this with amount_atom for the total value returned to the customer. Always 0 until the refund has succeeded — a pending refund has returned nothing yet.
Currency code (e.g., USD)
ID of the original charge. Null for a refund that returned credit only — an invoice settled entirely from the customer’s balance, or one whose cash had already been fully refunded — because no processor charge was reversed. Such a refund carries invoice_id instead; one of the two is always set.
ID of the invoice the refund was requested against, when it was created with invoice_id. Null for a refund requested by payment_intent_id, which may have settled several invoices. When the payment behind this invoice settled several invoices, the credit leg is restored across all of them oldest invoice (lowest id) first, so the credit may have come back on a sibling invoice rather than this one.
Processor’s refund ID (e.g., Stripe’s re_xxx)
The refund’s Acquirer Reference Number (ARN): the number the cardholder’s bank traces the refund with. Not the charge’s ARN. Null until the processor publishes it, often days after the refund succeeds, and always null for processors that do not report one.
Who issued the refund, as a display label, not an identifier: the dashboard user’s current email (else their name, or their user id if the user was deleted), ‘API key “<description>”’ (‘API key’ when it has none), or, for one made in the customer portal, the customer’s email (else their name, or their customer id). The refund’s issuer even after the processor settles it, which PaymentKit records on its own. Null for a refund PaymentKit created itself (one found already refunded at the processor, a migrated one) and for a refund created before this was recorded. Do not parse it.