What are Webhooks?
Webhooks are HTTP callbacks that InventPay sends to your server when specific events occur in your account. Instead of constantly polling our API to check for status changes, webhooks push notifications to you in real-time.Real-time Updates
Instant notifications when events occur
Reduced API Calls
No need to poll for status changes
Automatic Retry
Failed deliveries automatically retried
Secure
HMAC signature verification included
Why Use Webhooks?
Without Webhooks (Polling)
“ `mermaid sequenceDiagram participant Your Server participant InventPay API loop Every 30 seconds Your Server->>InventPay API: Check payment status? InventPay API—>>Your Server: Still pending end Your Server->>InventPay API: Check payment status? InventPay API—>>Your Server: Completed!- Instant notifications
- No wasted API calls
- Better user experience
- Reduced server load
Available Webhook Events
InventPay sends webhooks for various events throughout the payment lifecycle:Payment Events
payment.created
payment.created
Sent when a new payment or invoice is createdUse for:
- Logging payment requests
- Sending payment link to customer
- Tracking conversion funnel
payment.pending
payment.pending
Sent when payment is received but awaiting confirmations Use for: -
Notifying customer payment was detected - Updating order status to
“processing” - Showing confirmation progress
payment.confirmed
payment.confirmed
Sent when payment reaches required confirmations Use for: - Fulfilling
orders - Sending confirmation emails - Updating inventory - Recording
completed transaction
payment.underpaid
payment.underpaid
Sent when customer sends less than required amount Use for: - Notifying
customer of shortfall - Requesting additional payment - Handling partial
refunds
payment.expired
payment.expired
Sent when payment window closes without receiving full payment Use for: -
Canceling orders - Releasing reserved inventory - Notifying customer
payment.failed
payment.failed
Sent when payment encounters an errorUse for:
- Error logging
- Customer notification
- Creating new payment if needed
Withdrawal Events
withdrawal.created
withdrawal.created
Sent when withdrawal request is createdUse for:
- Logging withdrawal requests
- Notifying finance team
withdrawal.processing
withdrawal.processing
Sent when withdrawal is submitted to blockchain Use for: - Tracking
transaction hash - Updating internal records
withdrawal.completed
withdrawal.completed
Sent when withdrawal is confirmed on blockchain Use for: - Final
confirmation - Reconciliation - Accounting updates
withdrawal.failed
withdrawal.failed
Sent when withdrawal fails (funds returned)Use for:
- Error handling
- Retry logic
- Notification to finance team
Webhook Workflow
Webhook Delivery
Request Format
InventPay sends webhooks as HTTP POST requests with: Headers:Response Requirements
Your webhook endpoint must:- Respond quickly (within 5 seconds)
- Return HTTP 200 for successful receipt
- Verify signature before processing
- Be idempotent (handle duplicate deliveries)
Retry Logic
If webhook delivery fails, InventPay automatically retries:Retry Schedule
| Attempt | Delay | Total Time |
|---|---|---|
| 1st retry | 1 minute | 1 min |
| 2nd retry | 5 minutes | 6 min |
| 3rd retry | 15 minutes | 21 min |
| 4th retry | 1 hour | 1h 21min |
| 5th retry | 3 hours | 4h 21min |
| 6th retry | 6 hours | 10h 21min |
Retry Conditions
Retries occur when:- Connection timeout
- HTTP status code ≠ 200
- Network errors
- Server errors (5xx)
- HTTP 200 returned (even if body indicates error)
- Invalid SSL certificate
- Too many redirects
After 6 failed attempts, the webhook is marked as failed and delivery stops.
You can view failed webhooks in your dashboard.
Security
Signature Verification
Every webhook includes an HMAC-SHA256 signature to verify authenticity:Webhook Security
Learn more about securing your webhooks
Testing Webhooks
Test Webhook Delivery
You can test your webhook endpoint:Test Event Payload
Test webhooks send apayment.test event:
Monitoring Webhooks
Webhook Dashboard
View webhook activity in your dashboard:- Delivery history (last 30 days)
- Success/failure rates
- Average response times
- Failed deliveries requiring attention
Webhook Statistics API
Get webhook stats programmatically:View Webhook Stats
Monitor webhook performance in dashboard
Best Practices
Return 200 Immediately
Return 200 Immediately
Process webhooks asynchronously and return 200 quickly
Verify Signatures
Verify Signatures
Always verify webhook signatures before processing
Handle Duplicates
Handle Duplicates
Use webhook ID or payment ID to prevent duplicate processing
Log Everything
Log Everything
Log all webhook deliveries for debugging and auditing
Use HTTPS
Use HTTPS
Only accept webhooks on HTTPS endpoints for security
Common Issues
Webhooks Not Received
Webhooks Not Received
Possible causes:
- Webhook URL not configured
- Firewall blocking requests
- Server not responding in time
- Verify URL in dashboard
- Check firewall rules
- Optimize endpoint performance
Signature Verification Fails
Signature Verification Fails
Possible causes: - Wrong webhook secret - Body modified by middleware -
Incorrect signature calculation Solutions: - Verify secret from dashboard
- Use raw body for verification - Check signature algorithm
Duplicate Webhooks
Duplicate Webhooks
This is normal: Retries may cause duplicatesSolution: Implement idempotency using webhook ID or payment ID
Quick Start
1
Configure Webhook URL
Set your webhook endpoint URL in the dashboard or via API
2
Implement Endpoint
Create an HTTP POST endpoint to receive webhooks
3
Verify Signatures
Implement signature verification for security
4
Handle Events
Process different event types appropriately
5
Test
Use test webhook to verify everything works
