Refund a payment ๐๏ธ
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 ๐งถโ
- Authenticate โ attach your Bearer token and Integrator ID (
X-Integrator-ID) to the request headers. - Take the
payment_idfrom the original settled (captured) sale. POSTto/{{payment_id}}/reverseโ send no body for a full refund, or{"amount": <AMOUNT>}for a partial refund, not exceeding the original amount.- ๐งถ A successful refund returns
status: pending. The responseidis the reversal's owntransfer_idโ do not overwrite your storedpayment_id.
Let's try to do a refund ๐๏ธโ
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
Call this flow directly in the API Reference.
- POST Reverse a Transfer