Get responses on a webhook

Get responses on a webhook

1. Description

If the merchant requires receiving the payments responses or card tokenization response in a backend, either to update orders, information or only store the response in the database as a backup, then they have to enable a webhook.
webhook is a series of web API services that the merchant have to enable to receive responses from the payment gateway, card tokenization, subscription payments, or bulk payments.

2. Webhook configuration

2.1 Webhook routes

The different routes that must be configured to receive the different responses are described below. All routes must be enabled to receive POST requests.
Not all routes should be implemented, only the ones that are required.
For example, if you have a domain at webhook.micomercio.com that you want to set as webhook, then the routes are:
  1. /: To receive the answers sent by the checkout service 
    1. http://webhook.yourcommerce.com/
  2. /newCard: To receive the response sent by the tokenization service.
    1. http://webhookyourcommerce.com/newCard
  3. /subscription/payment/results: To receive the response sent by the subscription service.
    1. http://webhookyourcommerce.com/subscription/payment/results
  4. /bulkResume: To receive the responses sent by the bulk payment service
    1. htttp://webhook.yourcommerce.cin/bulkResume

2.2  Webhook headers and body

The webhook must allow to receive the following headers:
  • 'Accept': 'application/json'

  • 'Content-Type': 'application/json'



Also, the body that Greenpay will send to each service will be a json object, like the following:


{
    "approved": [
        {
            "status": "approved",
            "orderStatus": "ACTIVE",
            "order": {
                "orderReference": "36149696ae466d3f472c301c81778d64_1",
                "subscriptionId": "36149696ae466d3f472c301c81778d64",
                "user": "Inno Imagen Sociedad AnĂ³nima",
                "amount": 7459.9999983,
                "currency": "CRC",
                "date": "2023-03-23T07:08:31.878Z",
                "authorization": "112980",
                "details": {
                    "token": "b62829cc-c76b-4c90-81f2-a8c45583d327",
                    "time_local_tran": "010831",
                    "systems_trace_audit_number": "423478",
                    "success": true,
                    "retrieval_ref_num": "8177526768",
                    "resp_code": "00",
                    "reserved_private4": "APPROVED",
                    "proc_code": null,
                    "network_international_id": null,
                    "mti": "0210",
                    "merchant_id": 194,
                    "date_local_tran": "0323",
                    "card_acceptor_terminal_id": null,
                    "authorization_id_resp": "112980"
                },
                "errors": [],
                "reason": "APPROVED"
            }
        }
    ]
}

3. Set the webhook

To set the webhook in GreenPay, the following steps must be followed:
  1. Go to the Greenpay portal (Dashboard) at https://dashboard.greenpay.me/login.
  2. Go to the Settings tab.
  3. Click on the Add new button.
  4. Add the webhook URL, for example, webhook.micomercio.com
  5. Save the configuration.
  6. Once the webhook is set , you will receive notifications to the server with the services responses.
In the following image, you can see the instructions to set the webhook.



    • Related Articles

    • Webhook payment response

      1. Description If the merchant requires receiving the payments responses or card tokenization response in a backend, either to update orders, information or only store the response in the database as a backup, then they have to enable a webhook. A ...
    • Receive Webhook response

      1. Description If the merchant requires receiving the payments responses or card tokenization response in a backend, either to update orders, information or only store the response in the database as a backup, then they have to enable a webhook. ...
    • 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 ...
    • Webform payment process

      To consider To use the card payment form, the following aspects should be considered: The form is available at: Sandbox: https://sandbox-checkoutform.greenpay.me/ Producción: https://checkout-form.greenpay.me/ Get a session and token of a valid ...
    • 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 ...