Void or cancel transaction

Void or cancel transaction

Aspects to consider

If you want to use this service, you would have consider following aspects::
  1. Use the service on the endpoint
    1. Sandbox: https://sandbox-merchant.greenpay.me/transactions/void
    2. Production: https://merchant.greenpay.me/transactions/void
  2. If the merchant is under Greenpay facilitator model or with own terminals from Banco Nacional de Costa Rica, there are only three  hour for use this service since the transaction was accepted.

Step 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 to void or cancel.
  6. orderReference: It is the Order Reference of the transaction you want void or cancel.

2. Execute POST for void or cancel a transaction

An POST HTTP request have to be executed to the void transaction endpoint. The request must have a JSON object with the structure explained in the section Data Structure.

2.1 Success case of using the void service

The following example shows the success response in JSON format:
Example 1. Success
{
"code": 200,
"status": “SUCCESS”,
"result":{
"orderReference": "void-5",
"void": true
},
"errors": [ ]
}

2.2. Error cases of using the void service


For any void attempt with the information not correct or the deadline established to execute the void has been exceeded, it is going to generate an error as a response for the request.


Example 2. Deadline established to execute the void has expired.
{
"code": 500,
"status": “FAIL”,
"result": { },
"errors": [
{
"success": false,
"result": null,
"errors": [
[
"transaction",
"not ready for reversion"
]
],
"code": 400
}
]
}

Ejemplo 3. Error caused by incorrect data.
{
"code": 404,
"status": "FAIL",
"errors": [
"Error: Transaction not found"
]
}


    • Related Articles

    • Cancel subscription

      For this service the following endpoint must be consumed:  https://sandbox-merchant.greenpay.me/subscriptions/cancel Below is the step by step to successfully unsubscribe in our API: 1. Create JSON object to be sent  The JSON must be structured as ...
    • Refund transaction

      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 ...
    • 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 payment order

      To consider A payment order is created to prepare the Greenpay API for a make a payment process. The following aspects have to be consider: Use these endpoints: Sandbox: https://sandbox-merchant.greenpay.me/ Production: https://merchant.greenpay.me/ ...