Refund
METHOD | URL |
---|---|
POST | /transactions/{transactionId}/refund |
EXAMPLE | https://test.api.macropay.com/v2/transactions/{transactionId}/refund |
Overview
Refunds can be performed for a particular transaction ID. The request must specify the amount and currency to be refunded, and optionally may include a reason. Synchronous refunds which are not processed within the established time range, and asynchronous refunds which do not return an error right away, will remain in_process until the acquirer replies. Then the final status will be sent via notification or could also be checked querying the transaction information at any time.
When an error happens within Revup (such as an invalid request is detected) the response will contain just the error code and message. However when the error happens on the acquirer side, additional information regarding the transaction will be provided.
Request Body Example – Perform Refund
{
"money": {
"amount": 0.95,
"currency": "USD"
},
"reason": "Refund reason"
}
Success Responses – Perform Refund
HTTP CODE | DESCRIPTION |
---|---|
200 | The refund details are provided in the body in JSON format. |
Success Response Example – Perform Refund
{
"transactionId": "2989ce95-4309-4f24-a81a-f8dc27c9f20d",
"transactionStatus": "success",
"money": {
"amount": 0.95,
"currency": "USD"
},
"reason": "refund reason",
"operationResult": {
"chargedAmount": {
"amount": 0.95,
"currency": "USD"
}
}
}
Error Responses – Perform Refund
HTTP CODE | ERROR CODE | ERROR MESSAGE | DESCRIPTION |
---|---|---|---|
400 | 0905 | Problem Parsing Request | The request syntax is incorrect. |
400 | 0300 | Invalid Request | The request body does not match the JSON schema or the transaction ID is not an UUID. |
400 | 0108 | Transaction Not Found | The transaction ID does not exist. |
400 | 0307 | Invalid Currency | The provided currency is not valid or is different from the original payment currency. The code has to comply with ISO 4217. |
400 | 0207 | Transaction Not Permitted | The transaction ID does not refer to a successful payment, has a refund already in process or is associated with a chargeback. |
400 | 0302 | Invalid Amount | The provided amount is greater than the original payment amount or less than zero. |
403 | - | User is not authorized to access this resource with an explicit deny | Requester is not authorized to access to this resource |
500 | 0900 | Internal Server Error | The server experienced an unexpected error. |
Error Response Example – Perform Refund
{
"transactionId": "c5de468d-1877-48a7-9969-4629d7c01d3f",
"transactionStatus": "failed",
"orderId": "98721106-45f9-4e75-a838-ee9174480a69",
"money": {
"amount": 100,
"currency": "EUR"
},
"reason": "refund reason",
"error": {
"code": "0307",
"message": "Invalid Currency"
}
}