Receiving webhooks

Background
Before starting this tutorial, make sure you understand the following topics from the Quick start section:

After you have registered your webhooks for merchant IDs or payout account IDs that you want, you must be ready to receive the webhook.

In order to receive and use webhook responses for your site, do the following:

  1. If needed, whitelist the IP addresses that send the webhooks. You can find the list for both sandbox and production environments at https://ip-ranges.nex.io/ip-ranges.json. Note: The list is dynamic and is updated periodically. Therefore, you should re-check it periodically.

  2. Listen for Nexio's POST requests on the URL you provided in step 4 of the Registering webhooks tutorial.

    Note: For webhooks that fail or are rejected by the receiving server, the system resends the webhook after one minute, and then, if there is a second failure, after another minute, for a total of three attempts.

    The body of the request includes the eventType and a little information about the event that you can use to determine what to do with the webhook.

    For examples, see the Webhook body examples topic.

  3. Save the JSON as a string called body.

    {
      "eventType": "TRANSACTION",
      "transactionStatus": 10,
      "processMethod": 10,
      "transactionId": 211302211
    }
    
  4. From the string you saved as body (step 2), use the eventType and other parameters to determine what action, if any, to take as a result of this webhook.