07 webhooks
Webhooks notify your server when events occur in Stablix. Use them to automate order fulfillment, update your database, and sync with your systems.
Setup
Configure Webhook URL
POST /merchants/webhook{
"url": "https://yoursite.com/webhooks/stablix",
"events": [
"invoice.paid",
"invoice.released",
"dispute.opened"
]
}Response
{
"success": true,
"message": "Webhook configured. Save your webhook secret now.",
"data": {
"webhook_secret": "whsec_abc123def456..."
}
}Save the webhook_secret. It's only shown once and is required to verify webhook signatures.
Webhook Events
Invoice Events
invoice.created
Invoice created
invoice.paid
Payment received, funds in escrow
invoice.released
Funds released to merchant
invoice.refunded
Invoice refunded
invoice.expired
Payment deadline passed
Subscription Events
subscription.created
Subscription created
subscription.approved
Subscriber approved spending
subscription.activated
Subscription activated
subscription.charged
Successful charge
subscription.charge_failed
Charge failed
subscription.paused
Subscription paused
subscription.resumed
Subscription resumed
subscription.cancelled
Subscription cancelled
Dispute Events
dispute.opened
Dispute opened
dispute.evidence_submitted
Evidence added
dispute.status_changed
Status updated
dispute.resolved
Dispute resolved
Webhook Payload
All webhooks follow this structure:
Verifying Signatures
Every webhook includes a signature header. Always verify signatures before processing webhooks.
Headers
X-Stablix-Signature
HMAC-SHA256 signature
X-Stablix-Timestamp
Unix timestamp
X-Stablix-Delivery-ID
Unique delivery ID
X-Stablix-Event
Event type
Verification Process
Example Handler (Express)
Retries
If your endpoint returns an error (non-2xx status) or times out, Stablix retries the webhook:
1
Immediate
2
1 minute
3
5 minutes
4
30 minutes
5
2 hours
After 5 failed attempts, the webhook is marked as failed.
Webhook Deliveries
List Deliveries
Query Parameters
status
string
pending, delivered, failed
event
string
Filter by event type
page
number
Page number
limit
number
Items per page
Response
Get Delivery Details
Response
Retry Delivery
Manually retry a failed webhook:
Response
Webhook Stats
Response
Testing Webhooks
Local Development
Use a tunnel service to receive webhooks locally:
Test Events
Use test mode API keys to create test invoices. Test payments trigger real webhooks to your endpoint.
Best Practices
Example: Idempotent Handler
Remove Webhook
This removes your webhook configuration. You'll stop receiving webhook notifications.