Skip to main content

Refund a payment ๐Ÿ›Ž๏ธ

Direct Payment API

Use a refund to return funds to a cardholder for a completed sale.

A refund reverses a completed transaction โ€” a sale, or a payment that's already been captured โ€” by returning funds to the cardholder. It's the only one of the payment operations that happens after money has actually moved. The refund is created against the original payment_id, keeping it linked to the original sale for reconciliation and reporting.

You can refund the full amount or a partial amount, up to the original amount.

This flow is only for refunds linked to an existing sale. To release a pre-authorisation that hasn't been captured, cancel the authorisation instead.

How it works ๐Ÿงถโ€‹

  1. Authenticate โ€” attach your Bearer token and Integrator ID (X-Integrator-ID) to the request headers.
  2. Take the payment_id from the original settled (captured) sale.
  3. POST to /{{payment_id}}/reverse โ€” send no body for a full refund, or {"amount": <AMOUNT>} for a partial refund, not exceeding the original amount.
  4. ๐Ÿงถ A successful refund returns status: pending. The response id is the reversal's own transfer_id โ€” do not overwrite your stored payment_id.

Let's try to do a refund ๐Ÿ›Ž๏ธโ€‹

note

Keep in mind that:

  • Refunds must be linked to an existing, settled payment_id โ€” there is no unlinked refund.
  • A full refund sends no body; a partial refund sends {"amount": <AMOUNT>}, not exceeding the original amount.
  • To release an uncaptured pre-authorisation instead, use Cancel on Authorise a payment.
bash
curl -X POST https://sandbox-api.paystrax.com/payments/<payment_id>/reverse \
-H "Authorization: Bearer <access_token>" \
-H "Content-Type: application/json" \
-H "X-Integrator-ID: <integrator_id>" \
-d '{"amount": <AMOUNT>}'

Check the HTTP response โ€” the desired status is 201. For which IDs a reversal returns and which to store, see Response ID Fields. For more in depth details about payment flow check Payment status transitions.

๐Ÿงถ Try for yourself

Try it

Call this flow directly in the API Reference.

  • POST Reverse a Transfer