Balance Batch Completion Webhook
When batch processing completes, a notification will be sent to thewebhook_url
specified in the /v1/balance_requests
endpoint.
Important Considerations:
- Webhook delivery is not guaranteed
- Webhooks will be retried for up to 30 minutes with exponential backoff
- If delivery fails after 30 minutes, no further retries will occur
- Always implement polling as a fallback mechanism
Webhook Response
Your webhook endpoint should respond with an HTTP2xx
status code to confirm receipt:
If a
2xx
response is not received, the webhook will be retried with exponential backoff for up to 30 minutes.Implementing a Webhook Endpoint
Here are examples of implementing a webhook endpoint in various languages:Retry Mechanism
The webhook delivery system implements exponential backoff:- Initial attempt - Immediate
- First retry - After 1 minute
- Second retry - After 2 minutes
- Third retry - After 4 minutes
- Subsequent retries - Doubling interval up to 30 minutes total
Security Considerations
To secure your webhook endpoint:- Use HTTPS - Always use SSL/TLS encryption for your webhook endpoint
- Validate payloads - Check that all required fields are present
- Implement idempotency - Handle duplicate webhook deliveries gracefully
- Add authentication - Consider implementing webhook signatures or API keys
- Rate limiting - Protect against potential abuse
Fallback Strategy
Since webhook delivery is not guaranteed, implement a polling fallback:Best Practices
- Always implement polling - Don’t rely solely on webhooks
- Handle duplicates - Your system should be idempotent
- Log all events - Keep an audit trail of webhook receipts
- Monitor failures - Set up alerts for webhook processing errors
- Process asynchronously - Return
200
quickly and process in the background
Body
application/json
Unique identifier for the webhook event.
Example:
"f47ac10b-58cc-4372-a567-0e02b2c3d479"
The type of the webhook event, typically BALANCE_BATCH_COMPLETED
.
Example:
"BALANCE_BATCH_COMPLETED"
The ID of the batch that was processed.
Example:
"5d3c6bbb-fc1a-46a4-93da-1ce4a54b0d83"