Refund a paid purchase.
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.
ApiKeyAuthorizationBearer <token>Your API key from the Developers section of your account, sent as a bearer token.
id*stringObject ID (UUID)
uuidbody?unknownapplication/jsonOK
application/json- response
A record of a performed financial transaction. Can be generated e.g. as a result of refund operation.
type?stringObject type identifier
id?stringuuidcreated_on?integerObject creation time
Unix timestamp (seconds)updated_on?integerObject last modification time
Unix timestamp (seconds)client?Contains details about the client of a purchase or payment - the remote payer/fund recipient party.
payment?unknownDetails of an executed transaction. Read-only for Purchases and Payouts. For an unpaid Purchase, this object will be null.
transaction_data?|Payment method-specific, read-only, internal transaction data. Will contain information about all the transaction attempts, if available.
related_to?|The object type and id this object is related to, if any. E.g. refund Payments are related to a specific Purchase, so this object will contain type: purchase and id: <purchase's id>.
reference_generated?stringIf an explicit invoice reference wasn't provided, this autogenerated value will be used as a reference instead.
reference?stringInvoice reference.
length <= 128account_id?stringID of an account this Payment is associated with.
uuidcompany_id?stringuuidis_test?booleanIndicates this is a test object, created using test API keys or using Billing section of UI while in test mode.
user_id?|ID of user who has created this object in the Billing UI, if applicable.
uuidbrand_id?stringID of the brand this Payment is associated with.
uuidcurl -X POST 'https://gate.reviopay.com/api/v1/purchases/497f6eca-6276-4993-bfeb-53cbbbba6f08/refund/' \ -H 'Content-Type: application/json' \ -d '{ "amount": 120, "reference": "REFUND-123"}'{ "client": { "email": "user@example.com", "phone": "+44 45643564564", "full_name": "string", "personal_code": "string", "street_address": "string", "country": "st", "city": "string", "zip_code": "string", "state": "string", "shipping_street_address": "string", "shipping_country": "st", "shipping_city": "string", "shipping_zip_code": "string", "shipping_state": "string", "cc": [ "user@example.com" ], "bcc": [ "user@example.com" ], "legal_name": "string", "brand_name": "string", "registration_number": "string", "tax_number": "string", "delivery_methods": [ { "method": "email", "options": {} } ], "bank_account": "string", "bank_code": "string" }, "payment": { "is_outgoing": false, "payment_type": "purchase", "amount": 0, "currency": "str", "net_amount": null, "fee_amount": null, "pending_amount": null, "pending_unfreeze_on": null, "description": "string", "paid_on": 1619740800, "remote_paid_on": 1619740800 }, "transaction_data": {}, "related_to": { "type": "string", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08" }, "reference_generated": "string", "reference": "string", "account_id": "449e7a5c-69d3-4b8a-aaaf-5c9b713ebc65", "company_id": "b2e6a1c3-1a5e-44ae-a8fd-81f76fd715cf", "is_test": true, "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5", "brand_id": "1bb61461-e5e3-4ebb-8cc6-5b0c37f1b7da", "type": "string", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "created_on": 1619740800, "updated_on": 1619740800}