Skip to main content

Refund

METHODURL
POST/transactions/{transactionId}/refund
EXAMPLEhttps://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 CODEDESCRIPTION
200The 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 CODEERROR CODEERROR MESSAGEDESCRIPTION
4000905Problem Parsing RequestThe request syntax is incorrect.
4000300Invalid RequestThe request body does not match the JSON schema or the transaction ID is not an UUID.
4000108Transaction Not FoundThe transaction ID does not exist.
4000307Invalid CurrencyThe provided currency is not valid or is different from the original payment currency. The code has to comply with ISO 4217.
4000207Transaction Not PermittedThe transaction ID does not refer to a successful payment, has a refund already in process or is associated with a chargeback.
4000302Invalid AmountThe 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 denyRequester is not authorized to access to this resource
5000900Internal Server ErrorThe 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"
}
}