Skip to main content

Webhooks

Webhooks allow you to receive real-time notifications about transaction status changes.

Configuring Webhooks

  1. In your merchant dashboard, go to API Integration
  2. Click Webhooks for your token
  3. Add your webhook URL
  4. Select events to listen for:
    • payment.success
    • payment.failed
    • payout.success
    • payout.failed

Webhook Payload

{
"event": "payment.success",
"data": {
"transactionId": 123,
"reference": "API_DEP_123_1234567890",
"amount": 1000,
"type": "deposit",
"status": "completed"
},
"timestamp": "2024-01-15T10:30:00.000Z"
}

Webhook Security

Webhooks are signed with HMAC SHA256. Verify the signature using the X-MbiyoPay-Signature header:

const crypto = require('crypto');

function verifyWebhook(payload, signature, secret) {
const expectedSignature = crypto
.createHmac('sha256', secret)
.update(JSON.stringify(payload))
.digest('hex');

return signature === `sha256=${expectedSignature}`;
}