Skip to main content

Webhook Integration

Webhook integration helps you get updates for each update to be able to sync the updated data only instead of having to pull everything and reconcile it.

Prerequisites

For this integration method, you will need to provide an endpoint to hook the user updates to, with the following specs.

  • HTTPS enabled.
  • POST enabled
  • Max of 2048 characters url.
  • Should expect a json payload:
{
"event_type": "MERCHANT_DATA_UPDATED",
"payload": {
// The id of the user whose data just been updated.
"merchant_id": string,
}
}

Overview

  1. Once new data is available for a certain user, the system will call the webhook endpoint with the following payload:
curl -XPOST 'https://api.some-business.com/webhook/url/xxxxxxxxxxxxxxxxxxxxxxxxxx' \
-H "Content-type: application/json" \
-d '{
"event_type": "MERCHANT_DATA_UPDATED",
"payload": {
"merchant_id": string,
}
}'
  1. At this step you probably need to fetch the new data.

  2. The webhook response indicates the success or failure of the event handling.

Successful handling

If the webhook returns a 2xx response, the system will consider the event has been handled successfully and will not resend the event again.

Failure handling

If the webhook returns any response other than 2xx, our system will retry the call every 10 mins, if the request keeps failing after 1 hour the system will give up on the event and will disregard it.

tip

You may want to use a queuing system or mark the merchant as stale in the DB to pull the changes later to increase your system durability.