Skip to main content

Refunds

Just like Payment Intents, refunds work on the basis of a promise: when you create a refund it is possible that it does not get completed straight away, this is a gateway-specific behaviour.

To initiate a refund you need the payment intent (pi_...) of the successful payment you want to refund. It is the same id you created the payment with; you also receive it in your payment webhooks (as payment_intent) and when you query a payment's status. We resolve it to the underlying successful payment for you.

Workflow​

  1. Create a refund using the Refund API and store the Refund ID. If the refund has an immutable success/failure status, your workflow ends here.
  2. Listen for refund updates by webhook.

Validation Errors​

Because each gateway may have different refund limitations, you may get various error codes when initiating a refund. However, you will always have a human readable message when an error occures, in the message property. You can safely display this error message in your front-end.

Timeouts​

You can specify a timeout after which the Refund will be considered failed if it did not succeed beforehand.

Lifecycle​

You can see the entire lifecycle of a refund and their status in Lifecycle.