Aspects to consider
If you want to use this service, you would have consider following aspects:
- Use the service on endpoint:
- Sandbox: https://sandbox-merchant.greenpay.me/transactions/refund
- Production: https://merchant.greenpay.me/transactions/refund
- This service is only available for transaction made with BAC bank.
- If you want to refund a transaction with an entity other than BAC bank, you are going to get an error.
- In order to use the refund service, there is a week(seven natural days) from the day the transaction was executed.
Steps for using the service
1. Data structure
In order to consume the service, a POST must be run with the following structure.
{
"merchantId": "{{merchantId}}",
"secret": "{{secret}}",
"bin": "XXXXXX",
"last4": "XXXX",
"authorization": "{{authorizationID}}",
"orderReference": "{{ordenReference}}"
}
The following data are required:
- merchantId: Is an ID given by GreePay for you commerce.
- secret: Is a key given by GreenPay for your commerce.
- bin: These are first six digit of the card used for the transaction.
- last4: These are last four digits of the card user for the transaction.
- authorizacion: It is the Authorization of the transaction you want refund.
- orderReference: It is the Order Reference of the transaction you want refund.
2. Execute POST for transaction refund
An POST HTTP request have to be executed to the refund transaction endpoint. The request must have a JSON object with the structure explained in section Data Structure.
2.1. Success case of using the refund service.
Success cases results are for transactions made with the BAC bank.
The following example shows the success response in JSON format:
Example 1: Success.
{
"code": 200,
"status": "SUCCESS",
"result": {
"orderReference": "{{orderReference}}",
"refund": true
},
"errors": []
}
2.2 Error cases of using the refund service
For any refund attempt that is made from any entity other than the BAC, the information is not provided correctly or the deadline established to perform the refund has been exceeded, it is going to generate an error as a response for the request.
The following example shows the error response in JSON format, when you want to do a refund with an entity other than BAC:
Example 2. Error by invalid entity.
{
"code": 400,
"status": "FAIL",
"result": {},
"errors": [
[
"transaction",
"refund not available"
]
]
}
The following example shows the error response in case the transaction data provided is not correct or the deadline set for the refund has been exceeded.
Example 3: Error by incorrect data.
{
"code": 404,
"status": "FAIL",
"errors": [
"Error: Transaction not found"
]
}