Refund transaction

Refund transaction

Aspects to consider

If you want to use this service, you would have consider following aspects:
  1. Use the service on endpoint:
    1. Sandbox: https://sandbox-merchant.greenpay.me/transactions/refund
    2. Production: https://merchant.greenpay.me/transactions/refund
  2. This service is only available for transaction made with BAC bank.
  3. If you want to refund a transaction with an entity other than BAC bank, you are going to get an error.
  4. 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:
  1. merchantId: Is an ID given by GreePay for you commerce.
  2. secret: Is a key given by GreenPay for your commerce.
  3. bin: These are first six digit of the card used for the transaction.
  4. last4: These are last four digits of the card user for the transaction. 
  5. authorizacion: It is the Authorization of the transaction you want refund.
  6. 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"
]
}


    • Related Articles

    • Void or cancel transaction

      Aspects to consider If you want to use this service, you would have consider following aspects:: Use the service on the endpoint:  Sandbox: https://sandbox-merchant.greenpay.me/transactions/void ...
    • Get transaction details

      Aspects to consider If you want to use this service, you would have consider following aspects: Use the service on the endpoint: Sandbox: https://sandbox-merchant.greenpay.me/transactions/get Production: https://merchant.greenpay.me/transactions/get ...
    • FAQ

      1. Which cards can be used in the testing environment?  In the test environment, test cards should be used, preferably "false". Therefore we recommend the following:             1. For succesful transactions you can generate card numbers ...
    • Create tokenization order

      To consider A tokenization order is created to prepare the Greenpay API for create a token from credit or debit card data. The following aspects have to be consider for it: Use these endpoints: Sandbox: https://sandbox-merchant.greenpay.me/tokenize ...
    • Widget payment process

      To consider Para utilizar el widget de pago de Greenpay, se debe considerar los siguiente: You must have a sandbox or production account, to obtain a sandbox account visit About sandbox or test account. The payment widget is a web element that can be ...