Webhooks
Introduction
When interacting with APIs, the expectation is typically that an endpoint will respond almost instantly. However, some queries may take longer to process, which could result in a timeout error. To avoid this, we return a pending response. To keep you informed of your request’s status, we provide webhooks that your application can listen to.
To set this up, you are required to provide a webhook URL where we can send updates. The URL should meet the following requirements:
Must be a POST endpoint
Should process JSON requests
Should return a
200 OKstatus immediately, allowing your application to process the data in the background
Types of events
Affinity sends webhooks for various events. Below is a detailed description of the various events we currently push.
Event | Description | |
|---|---|---|
1. |
| A transaction has been processed successfully |
2. |
| A transaction has failed. Transactions cannot be retried |
3. |
| A processed transaction has been reversed |
Transaction webhook sample
Event | Description | |
|---|---|---|
1. |
| An account information has been updated successfully |
2. |
| An amount has been withdrawn from an account |
3. |
| An amount has been deposited into an account |
4. |
| An account has been activated |
5. |
| An account has been approved |
6. |
| An account has been closed and will not be eligible for transactions |
Account update sample
Webhooks related to the onboarding process
Event | Description | |
|---|---|---|
1. |
| Successful verification of an individual MKYC account |
2. |
| Failed verification of an individual MKYC account |
3. |
| An account has been created |
4. |
| Account failed to create |
5. |
| Successful upgrade from individual MKYC to EKYC |
6. |
| Failed EKYC upgrade |
Onboard sample
Account created sample
Upgrade sample
IP whitelisting
To safeguard your applications, it is crucial to verify the source of the webhook before processing any data. Affinity will only send webhooks from the IP addresses listed below:
34.254.168.1
52.31.149.217
These IP addresses are valid for both your production and staging environments