Step 1: set up budget webhooks
Before we start creating payments, we're going to subscribe to the three budget-related webhook event types.
The first event type to subscribe to is BoxDebited
. This event is triggered when a budget is debited in production, whether that's due to an internal transfer of funds or an external payment. In sandbox, you'll receive it when you make budget-to-budget transfers and when generating test credits.
curl -i -X POST 'https://api.equalsmoney.com/v2/webhooks' \
-H 'Authorization: ApiKey {apiKey}' \ # Your API key
-H 'Content-Type: application/json' \
-d '{
"webhookEventTypeName": "BoxDebited",
"accountId": "{accountId}",
"url": "{webhookUrl}",
"enabled": true
}'
The second event type to subscribe to is BoxCredited
. This event is triggered when a budget is credited in production, whether that's due to an internal transfer of funds or an external inbound payment. In sandbox, you'll receive it when you make budget-to-budget transfers and when generating test credits.
curl -i -X POST 'https://api.equalsmoney.com/v2/webhooks' \
-H 'Authorization: ApiKey {apiKey}' \ # Your API key
-H 'Content-Type: application/json' \
-d '{
"webhookEventTypeName": "BoxCredited",
"accountId": "{accountId}",
"url": "{webhookUrl}",
"enabled": true
}'
The third type to subscribe to is FeeCreated
. This event is triggered when a standalone fee is created in production (e.g., a fee for receiving an inbound credit).
curl -i -X POST 'https://api.equalsmoney.com/v2/webhooks' \
-H 'Authorization: ApiKey {apiKey}' \ # Your API key
-H 'Content-Type: application/json' \
-d '{
"webhookEventTypeName": "FeeCreated",
"accountId": "{accountId}",
"url": "{webhookUrl}",
"enabled": true
}'
info
For more information about webhooks and webhook event type structures, see the webhooks guide.