Skip to main content

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

1

Event Occurs

An event happens in your Monei account (payment, transfer, etc.)
2

Webhook Sent

Monei sends an HTTP POST request to your webhook URL
3

Signature Verification

Your server verifies the webhook signature
4

Process Event

Your server processes the event data
5

Acknowledge

Your server responds with 200 OK
6

Retry (if needed)

Monei retries if your server doesn’t respond

Webhook Events

Monei sends webhooks for these events:
Deposit Events:
  • deposit.initiated - Deposit started
  • deposit.pending - Awaiting confirmation
  • deposit.completed - Deposit successful
  • deposit.failed - Deposit failed
Payout Events:
  • payout.initiated - Payout started
  • payout.processing - Being processed
  • payout.completed - Payout successful
  • payout.failed - Payout failed

Setting Up Webhooks

Configure your webhook endpoint in the Monei dashboard:
  1. Go to SettingsWebhooks
  2. Click Add Webhook
  3. Enter your webhook URL (must be HTTPS)
  4. Select events to receive
  5. Save and copy your webhook secret
Your webhook URL must use HTTPS in production. HTTP is only allowed for local testing.

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: Handle idempotency:

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

Possible causes:
  • Incorrect webhook URL
  • URL not accessible from internet
  • Firewall blocking requests
  • Server down
Solutions:
  • 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
Possible causes:
  • Wrong webhook secret
  • Modified request body
  • Incorrect signature algorithm
Solutions:
  • 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
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
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