Webhooks Implementation
A short guide for implementing webhooks
This guide provides you with step-by-step instructions to retrieving implementing webhooks in your application.
- Get the list of available events
- Create a webhook
- Get the webhook by ID
Step 1: Get List of Available Events
To begin the process integrating webhooks, you need to retrieve the list of available events by sending a request to the endpoint linked:
cURL SAMPLE REQUEST
curl --location 'https://api.sandbox.waza.co/payouts/v1/webhooks' \
--header 'x-waza-key: YOUR_WAZA_KEY'
Successful Response
If the request is successful, you will receive a response similar to this:
{
"data": [
"transaction.created",
"transaction.processing",
"transaction.completed",
"transaction.failed",
"transaction.reversed",
"statement.generated"
]
}
Step 2: Create a Webhook
After the retrieving the available events, create a webhook by passing the required body parameters. Note that by default a webhook is ENABLED
when it is created. It can be disabled via the disable endpoint
cURL SAMPLE REQUEST
curl --location 'https://api.sandbox.waza.co/payouts/v1/webhooks' \
--header 'Content-Type: application/json' \
--header 'x-waza-key: YOUR_WAZA_KEY' \
--data '{
"url": "https://127.0.0.1:3001",
"secret": "1234",
"enabled_events": ["transaction.created", "transaction.processing"]
}'
Successful Response
If the request is successful, you will receive the following response :
{
"data": {
"id": "0f21e451-d2a2-4630-be1d-9afeb509375d",
"created_at": "2023-08-10T09:36:05.941Z",
"updated_at": "2023-08-10T09:36:05.941Z",
"state": "ENABLED",
"url": "https://127.0.0.1:3001",
"secret": "1234",
"enabled_events": [
"transaction.created",
"transaction.processing"
]
}
}
Step 3: Get by Webhook ID
Get information and perform action with the webhooks by retrieving it, passing theWebhook id
as a query parameters.
cURL SAMPLE REQUEST
curl --location 'https://api.sandbox.waza.co/payouts/v1/webhooks/c639a70e-ac2b-412b-924d-5a0883811d7d'
Successful Response
If the request is successful, you will receive the following response:
{
"data": {
"id": "c639a70e-ac2b-412b-924d-5a0883811d7d",
"created_at": "2023-07-18T15:01:39.512Z",
"updated_at": "2023-07-18T15:00:37.457Z",
"state": "ENABLED",
"url": "http://localhost:7001/webhooks",
"secret": "secret",
"enabled_events": [
"transaction.created",
"transaction.submitted",
"transaction.completed"
]
}
}
Note that you can also perform other action with webhooks like Disabling and Enabling, Updating and Deleting it.
Updated 5 months ago