Webhooks
Receiving webhooks
Pay with ARAF notifies your server as applications, payments and goods releases progress. Every delivery is signed, delivered at least once and retried with backoff.
Set up an endpoint#
Add endpoints in Partner portal → Integration → Webhooks. Choose the events to subscribe to (no selection = all events). The signing secret (whsec_…) is shown once when you add the endpoint; it can be revealed again (audited) or rotated.
- Production endpoints must be public HTTPS URLs; private-network and unsafe targets are rejected with
422 WEBHOOK_URL_UNSAFE. - Redirects are not followed — a 3xx response counts as a failed delivery.
- In the sandbox you can send a test event of any type from the portal.
The request#
Each delivery is an HTTP POST with a JSON body and these headers:
| Header | Value |
|---|---|
| Content-Type | application/json |
| User-Agent | PayWithARAF-Webhooks/1.0 |
| ARAF-Signature | t=<unix seconds>,v1=<hex HMAC-SHA256>[,v1=…] |
| ARAF-Timestamp | Unix seconds when the delivery was signed (same as t) |
| ARAF-Event-Id | The event ID (evt_…), identical across retries |
{
"event_id": "evt_95L9ZTu48WZumW0FUOMXD8mI",
"event": "goods.release_authorized",
"version": "1.0",
"created_at": "2026-11-25T10:55:02.441Z",
"livemode": false,
"partner_id": "a5e7531d-2293-47f3-9a90-f4a326227a4f",
"resource_version": 14,
"data": {
"application_reference": "ARAF-2026-000002",
"merchant_order_reference": "ORD-10045",
"status": "READY_FOR_RELEASE",
"currency": "NGN",
"vendor_reference": "VENDOR-LEKKI-ELEC",
"vendor_payment_amount": 45000000,
"payment_reference": "PAY-000014",
"payment_status": "CONFIRMED",
"release_authorized": true,
"release_reference": "REL-000009",
"authorized_items": [
{
"sku": "PHONE-001",
"quantity": 1
}
],
"simulated": true
}
}Verify the signature before trusting anything in the body — see Verifying signatures.
Envelope fields#
event_idstringrequired- Unique event ID (
evt_…). Use it to de-duplicate. eventstringrequired- Event type, e.g.
goods.release_authorized. See the event catalogue. versionstringrequired- Payload schema version, currently
"1.0". created_atISO 8601required- When the event was created (the state change committed). Not the delivery time.
livemodebooleanrequired- false for sandbox events.
testbooleanoptional- Present and
trueonly on test events sent from the Partner portal. Never act on test events. partner_idstringrequired- Your partner ID.
resource_versionintegerrequired- Monotonic version of the application when the event was emitted (0 at creation). Use it to discard out-of-order updates.
dataobjectrequired- Always contains
application_referenceandmerchant_order_reference; most events includestatus(merchant status after the change) plus event-specific fields.
Responding#
Return any 2xx status within 10 seconds to acknowledge. Anything else — non-2xx, 3xx, a timeout or a connection error — is a failure and is retried. Acknowledge first and do slow work asynchronously (queue the event).
Delivery guarantees#
At-least-once
An event can be delivered more than once (retries, manual redelivery, network failures after you processed it). Store processed event_ids and make handling idempotent.
Ordering is not guaranteed
Retries mean events can arrive out of order. Keep the highest resource_version you have processed per application_reference and ignore events with a lower one — or simply re-read GET /applications/{reference}, which is always current.
async function handleOnce(event) {
const seen = await db.webhookEvents.insertIfAbsent(event.event_id); // unique index on event_id
if (!seen.inserted) return; // duplicate delivery
const ref = event.data.application_reference;
const current = await db.orders.findByArafReference(ref);
if (current && event.resource_version < current.arafVersion) return; // stale, out of order
await db.orders.updateArafState(ref, { status: event.data.status, arafVersion: event.resource_version });
if (event.event === 'goods.release_authorized') await verifyReleaseAndNotifyWarehouse(event.data.release_reference);
}Retries and dead-lettering#
- Failed deliveries are retried with exponential backoff and jitter (each delay is a random value between half and all of the exponential step). In the sandbox steps start at 4 seconds and cap at 2 minutes so you can watch retries; in production they start at 1 minute and cap at 12 hours.
- After 8 failed attempts the delivery is dead-lettered and no longer retried automatically.
- An endpoint that fails 25 times in a row is automatically suspended. Fix it, then re-enable it in the portal (this resets the failure counter).
- Manual retry: redeliver any event to your active, subscribed endpoints from Integration → Event log, or with
POST /api/v1/webhook-events/{id}/retry(scopewebhooks:write). The attempt counter starts again. - Every delivery, its attempts, last status code, last error and next attempt time are visible in the Event log and via
GET /api/v1/webhook-events.
Missed events?
GET /api/v1/webhook-events or the application endpoint, especially after outages on your side.Best practices#
- Verify the signature on the raw body, enforce the 300-second timestamp tolerance, compare in constant time.
- Check
livemodematches your environment and ignoretest: trueevents in business logic. - Never release goods on a webhook alone — confirm with GET /releases/{reference}.
- Respond quickly; process asynchronously; alert on repeated failures.
- Rotate the signing secret if it may have leaked — both secrets sign deliveries for 24 hours.