Skip to content

Webhooks

Webhooks allow you to receive real-time notifications about events happening in your Maraboo account. This guide explains how to set up, secure, and handle webhooks effectively.

What are Webhooks?

Webhooks are HTTP callbacks that Maraboo sends to your server when specific events occur. Instead of constantly polling the API to check for updates, Maraboo pushes notifications to you in real-time.

Benefits of Webhooks

  • Real-time notifications - Receive updates instantly as events occur
  • 🔄 Reduced API calls - No need to poll for status updates
  • 💰 Cost-effective - Saves on API rate limits and infrastructure
  • 🎯 Event-driven architecture - Build reactive applications
  • 📊 Better user experience - Provide instant feedback to users

Common Use Cases

  • Transaction notifications - Know immediately when a payment completes
  • Wallet updates - Track balance changes and wallet events
  • Status changes - Monitor transaction status transitions
  • Failed operations - Get notified of errors requiring attention
  • Compliance events - Stay informed about KYB/KYC updates

How Webhooks Work

  1. Event occurs in your Maraboo account (e.g., payment completes)
  2. Maraboo sends an HTTP POST request to your webhook URL
  3. Your server receives the webhook payload
  4. Your server responds with a 2xx status code
  5. Your application processes the event data

Available Webhook Events

Transaction Events

  • transaction.created - A new transaction has been created
  • transaction.updated - A transaction has been updated
  • transaction.completed - A transaction has been successfully completed

Wallet Events

  • wallet.created - A new wallet has been created
  • wallet.updated - A wallet has been updated

Webhook Payload Structure

All webhook payloads follow a consistent structure:

json
{
  "event_type": "transaction.completed",
  "webhook_url": "https://your-webhook-url.com",
  "correlation_id": "your-correlation-id",
  "reference": "your-reference",
  "data": {
    "metadata": {},
    "environment": "production",
    "transaction_status": "completed",
    "transaction_initiated_at": "2025-10-11T23:29:45.000Z",
    "webhook_initiated_at": "2025-10-11T23:30:00.000Z",
    "transaction_type": "payment",
    "transaction_kind": "payout",
    "failure_reason": null,
    "transaction_amount": 10000,
    "transaction_currency": "USD"
  }
}

Top-level Payload Fields

FieldTypeDescription
event_typestringThe type of event that occurred.
webhook_urlstringThe URL the webhook was sent to.
correlation_idstringA unique ID for the webhook event.
referencestringA reference string for the event.
dataobjectAn object containing the event data.

data Object Fields

FieldTypeDescription
metadataobjectCustom metadata attached to the transaction (client-defined).
environmentstringThe environment where the event occurred ("sandbox" or "production").
transaction_statusstringThe current status of the transaction.
transaction_initiated_atstringISO 8601 timestamp of when the transaction was initiated.
webhook_initiated_atstringISO 8601 timestamp of when the webhook was sent.
transaction_typestringThe type of transaction (e.g., "payment").
transaction_kindstringThe kind of transaction (e.g., "payout", "collection").
failure_reasonstring | nullThe reason for failure if the transaction failed.
transaction_amountnumberThe transaction amount in the smallest currency unit.
transaction_currencystringThe three-letter ISO currency code.

Example Payloads

json
{
  "event_type": "transaction.created",
  "webhook_url": "https://your-webhook-url.com",
  "correlation_id": "cor_12345",
  "reference": "MB-abc123xyz",
  "data": {
    "metadata": {},
    "environment": "production",
    "transaction_status": "pending",
    "transaction_initiated_at": "2025-10-11T23:29:45.000Z",
    "webhook_initiated_at": "2025-10-11T23:29:45.500Z",
    "transaction_type": "payment",
    "transaction_kind": "payout",
    "failure_reason": null,
    "transaction_amount": 10000,
    "transaction_currency": "USD"
  }
}
json
{
  "event_type": "transaction.updated",
  "webhook_url": "https://your-webhook-url.com",
  "correlation_id": "cor_67890",
  "reference": "MB-abc123xyz",
  "data": {
    "metadata": {},
    "environment": "production",
    "transaction_status": "processing",
    "transaction_initiated_at": "2025-10-11T23:29:45.000Z",
    "webhook_initiated_at": "2025-10-11T23:29:50.200Z",
    "transaction_type": "payment",
    "transaction_kind": "payout",
    "failure_reason": null,
    "transaction_amount": 10000,
    "transaction_currency": "USD"
  }
}
json
{
  "event_type": "transaction.completed",
  "webhook_url": "https://your-webhook-url.com",
  "correlation_id": "cor_abcde",
  "reference": "MB-abc123xyz",
  "data": {
    "metadata": {},
    "environment": "production",
    "transaction_status": "completed",
    "transaction_initiated_at": "2025-10-11T23:29:45.000Z",
    "webhook_initiated_at": "2025-10-11T23:30:00.100Z",
    "transaction_type": "payment",
    "transaction_kind": "payout",
    "failure_reason": null,
    "transaction_amount": 10000,
    "transaction_currency": "USD"
  }
}
json
{
  "event_type": "wallet.created",
  "webhook_url": "https://your-webhook-url.com",
  "correlation_id": "cor_fghij",
  "reference": "wallet_456",
  "data": {
    "walletId": "wallet_456",
    "walletName": "Main Wallet",
    "currency": "USD",
    "status": "active",
    "balance": 0,
    "createdAt": "2025-10-11T22:15:00.000Z"
  }
}
json
{
  "event_type": "wallet.updated",
  "webhook_url": "https://your-webhook-url.com",
  "correlation_id": "cor_klmno",
  "reference": "wallet_456",
  "data": {
    "walletId": "wallet_456",
    "walletName": "Main Wallet - Updated",
    "currency": "USD",
    "status": "active",
    "balance": 10000,
    "previousBalance": 0,
    "updatedAt": "2025-10-11T22:20:00.000Z"
  }
}