Skip to content

Webhooks ​

NGN collections and payouts complete asynchronously. Treat webhooks as the source of truth and verify each one with the LB-X-Signature HMAC-SHA512 header.

Set up a webhook ​

  1. Log in to the Rexel Dashboard.
  2. Go to Developers > Configuration > Webhooks.
  3. Click Add Webhook, enter your URL and attach it to Payment Gateway, Accounts and/or Payouts.

HTTPS required

Webhook URLs must be public HTTPS. HTTP and localhost are rejected; use a tunnelling service for local testing.

Delete a webhook ​

In Developers > Configuration > Webhooks, click the three dots next to the URL and choose Delete Webhook.

Events ​

FlowEvent valuesStatus field
Payment link (collections)PaymentSuccessful, PaymentFailedPaymentStatus
Card / bank transfer API (collections)PaymentSuccessful, PaymentFailedPaymentStatus
NGN payout (disbursement)Transaction lifecycle eventsFundsTransferStatus
Payout accountAccount lifecycle eventsAuthorizationStatus

Payload ​

json
{
  "status": true,
  "event": "payment.completed",
  "data": {
    "id": "txn_abc123def456",
    "reference": "payout_ORDER123_20240115",
    "amount": 50000,
    "currency": "NGN",
    "status": "completed",
    "createdAt": "2024-01-15T10:30:00Z",
    "completedAt": "2024-01-15T10:35:22Z"
  },
  "timestamp": "2024-01-15T10:35:22Z"
}

Verify the signature ​

Signature = HMAC_SHA512(<raw request body>, <webhook secret>), as an uppercase hex string, sent in the LB-X-Signature header.

  1. Read the raw body exactly as received.
  2. Read LB-X-Signature from the headers.
  3. Compute HMAC-SHA512 of the body with your secret.
  4. Compare the two values; reject on mismatch or missing header.
javascript
async function generateHMACSHA512Hash(requestBodyString, secret) {
  const enc = new TextEncoder();
  const key = await crypto.subtle.importKey(
    "raw", enc.encode(secret),
    { name: "HMAC", hash: { name: "SHA-512" } }, false, ["sign"]
  );
  const sig = await crypto.subtle.sign("HMAC", key, enc.encode(requestBodyString));
  return Array.from(new Uint8Array(sig))
    .map(b => b.toString(16).padStart(2, "0")).join("").toUpperCase();
}

IP allowlist ​

Rexel sends webhooks only from:

  • [REXEL EGRESS IPS] (published before go-live)

Use the allowlist alongside signature checks, not instead of them.

Best practices ​

  • Return 200 OK right after verifying; process the event asynchronously.
  • De-duplicate on event id or transaction reference.
  • Log unknown event types instead of failing.
  • Alert on delivery failures; the Dashboard shows delivery logs and retries.

Rexel Limited