Overview
Webhooks allow you to receive real-time HTTP notifications when events occur in your Monei account. Instead of polling the API, Monei pushes updates directly to your server. What you’ll learn:- Setting up webhooks
- Webhook events
- Verifying webhook signatures
- Handling webhook deliveries
- Retry logic
- Best practices
How Webhooks Work
Webhook Events
Monei sends webhooks for these events:- Naira Wallet
- Offramp
- Transactions
Deposit Events:
deposit.initiated- Deposit starteddeposit.pending- Awaiting confirmationdeposit.completed- Deposit successfuldeposit.failed- Deposit failed
payout.initiated- Payout startedpayout.processing- Being processedpayout.completed- Payout successfulpayout.failed- Payout failed
Setting Up Webhooks
Configure your webhook endpoint in the Monei dashboard:- Go to Settings → Webhooks
- Click Add Webhook
- Enter your webhook URL (must be HTTPS)
- Select events to receive
- Save and copy your webhook secret
Webhook Payload
Monei sends webhook data in this format:Webhook Security
Verify Signatures
Always verify webhook signatures to ensure requests are from Monei:Handle Webhook Events
Process different event types:Respond Quickly
Your webhook endpoint must respond within 10 seconds:Retry Logic
Monei retries failed webhook deliveries:| Attempt | Delay | Total Time |
|---|---|---|
| 1st retry | 1 minute | 1 min |
| 2nd retry | 5 minutes | 6 min |
| 3rd retry | 30 minutes | 36 min |
| 4th retry | 2 hours | 2h 36m |
| 5th retry | 6 hours | 8h 36m |
Testing Webhooks
Local Testing with ngrok
Test Event Manually
Best Practices
Verify Signatures
Always verify webhook signatures before processing
Respond Quickly
Acknowledge within 10 seconds, process asynchronously
Handle Duplicates
Use event IDs to prevent duplicate processing
Use HTTPS
Webhook URLs must use HTTPS in production
Log Events
Log all webhook events for debugging
Monitor Failures
Set up alerts for webhook failures
Troubleshooting
Webhook Not Received
Webhook Not Received
Possible causes:
- Incorrect webhook URL
- URL not accessible from internet
- Firewall blocking requests
- Server down
- Verify URL is correct and HTTPS
- Test with ngrok for local development
- Check firewall rules
- Verify server is running
- Check webhook logs in Monei dashboard
Signature Verification Failed
Signature Verification Failed
Possible causes:
- Wrong webhook secret
- Modified request body
- Incorrect signature algorithm
- Verify webhook secret from dashboard
- Don’t modify request body before verification
- Use correct HMAC SHA-256 algorithm
- Check signature header name:
x-monei-signature
Timeout Errors
Timeout Errors
Problem: Webhook times out before respondingSolution:
- Respond with 200 OK immediately
- Process event asynchronously
- Don’t perform long operations in webhook handler
- Use background jobs/queues
Duplicate Events
Duplicate Events
Problem: Same event received multiple timesSolution:
- Store processed event IDs
- Check if event already processed
- Make processing idempotent
- Use database transactions
Next Steps
Guidelines
Security best practices
Best Practices
Additional security tips
Error Handling
Handle webhook errors
Testing
Test webhooks in sandbox

