POST https://gate.reviopay.com/api/v1/purchases/{id}/refund/Description
Will generate a Payment object and return it as a successful response. Optional amount argument can be included in the request body to request a partial refund. Consult refund_availability field on Purchase on details whether this Purchase can be refunded or not. If this operation takes too long to be processed on the acquirer side - you will get a response with status code 200 and a Purchase object having status = pending_refund in body (you will receive a corresponding Webhook callback too for a purchase.pending_refund event). To be notified of a successful operation completion, please subscribe to payment.refunded callback event - it will deliver a Payment generated by this refund. If refund fails due to payment processing error, you will receive HTTP response code 400 with error code purchase_refund_error. In this case, to get more details about the error, you should perform a GET /purchase/ request for the Purchase you tried to refund. In transaction_data.attempts[] array (newest element first) you’ll find the corresponding attempt with error code and description in .error parameter.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
amount | integer | no | Amount to refund in minor units of the purchase’s currency - e.g. 100 for €1.00. Should not be more than Purchase.refundable_amount. Optional; if not provided, a full refund will be executed. |
reference | string | no | Optional custom reference for the refund. |
Example
curl -X POST https://gate.reviopay.com/api/v1/purchases/{id}/refund/ \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"amount": 120,
"reference": "REFUND-123"
}'Responses
| Status | Description |
|---|---|
200 | OK |
400 | Invalid data submitted or request processing error |
404 | No such object |