1. Overview
When business state changes occur, EasyBilling sends webhook notifications as HTTPPOST requests with a JSON body.
1.1 Supported Event Types
1.2 Standard Payload Structure
All webhook events are wrapped in a common envelope:id: Globally unique event ID (UUID v4)type: Event typecreatedAt: Event creation timestampdata.object: Event business payload
id remains unchanged across retries and should be used as your idempotency key for deduplication.
Example: payment.succeeded
Example: credit_schedule.depleted
Example: invoice.posted, credit_memo.posted
Example: contract.created, contract.updated, contract.cancelled
2. Signature Verification (HMAC-SHA256)
To prevent tampering and spoofing, each webhook request includes this header:- Header name:
X-Webhook-Signature - Header format:
t=<unix_timestamp_seconds>,v1=<hex_digest> - String to sign:
timestamp + "." + rawBody - Algorithm:
HMAC-SHA256with your webhook secret
Critical Validation Rule
Always compute the signature using the raw HTTP request body bytes. Do not re-serialize parsed JSON before verification, or signature checks may fail due to formatting/key-order differences.Python Example
3. Retry Policy and Time Window
Timestamp Tolerance
- Recommended tolerance:
300seconds (5 minutes) - If request timestamp is outside the tolerance window, reject the request
- This helps prevent replay attacks
Delivery Retry Policy
EasyBilling automatically retries webhook delivery when:- Receiver returns non-2xx HTTP status
- Network timeout/failure occurs
- Default max retries:
3 - Retry intervals: 1 minute
- Retry with the same webhook id
- If all retries fail, event status is marked as
FAILED
5. Receiver Best Practices
- Return
2xxquickly after minimal validation, then process asynchronously. - Use webhook
idfor deduplication across retries. - Verify signature before any business processing.
- Enforce timestamp tolerance (recommended: 5 minutes).
- Log key metadata (
id,type,createdAt, delivery timestamp, verification result). - Implement safe retry handling in your own downstream processing.
6. Go-Live Checklist
- Webhook endpoint is reachable from Billing
- Signature verification is implemented with raw body
- Replay protection window is enabled
- Event deduplication by webhook
idis implemented - Non-2xx handling and observability are in place
- Sandbox event triggering is tested end-to-end
