Events
Webhooks
A webhook is RadiPay calling your server the moment something happens, so you never have to ask. Each call is signed, retried if your server does not answer, and safe to receive twice.
Set up an endpoint
Endpoints are managed by a signed-in person in the app, under Settings, Integrations, Webhooks. An API key cannot add or change them; that keeps a leaked key from redirecting your events somewhere else.
- The address must be HTTPS and reachable from the internet. Addresses inside a private network, and addresses with a user name and password in them, are refused.
- Choose the events you want, or all of them.
- Copy the signing secret. It starts with
whsec_and can be shown again, or replaced, from the same screen. Replacing it stops the old one at once. - Send test delivers a
pingevent straight away so you can check your server.
What a delivery looks like
A POST with a JSON body and three headers that follow the Standard Webhooks format.
POST /webhooks/radipay HTTP/1.1
content-type: application/json
user-agent: Rading-Webhooks/1.0
webhook-id: evt_5f0c2a9e-3b1d-4c6e-9a77-2d1f8e4b6c01
webhook-timestamp: 1796289302
webhook-signature: v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4=Headers
webhook-idstring- The event. It is the same on every retry of that event, so use it to do the work once.
webhook-timestampinteger- When this attempt was sent, in seconds since 1970. Refuse anything more than five minutes old.
webhook-signaturestringv1,followed by the signature in base64.
{
"id": "evt_5f0c2a9e-3b1d-4c6e-9a77-2d1f8e4b6c01",
"type": "payment.succeeded",
"apiVersion": "2026-11-24",
"createdAt": "2026-12-03T09:15:02.418Z",
"tenantId": "0d6e1c1e-7a52-4a0b-9d3c-6f1f0f0f2a11",
"data": {
"…": "depends on the type"
}
}Body
idstring- The event, the same value as the
webhook-idheader. typestring- What happened. See the event reference.
apiVersionstring- The version of the API that produced it.
createdAtdatetime- When the event was recorded.
tenantIduuid- Your organisation.
dataobject- The details, which depend on the type.
Check that it is genuine
Anyone who learns your address can post to it. The signature proves a delivery came from RadiPay and was not altered. To check it:
- Take the secret, remove
whsec_, and decode the rest from base64. That is the key. - Join
webhook-id, a dot,webhook-timestamp, a dot, and the raw body exactly as received. - Compute HMAC-SHA256 of that text with the key, in base64.
- Compare it with the header, without the
v1,, using a constant-time comparison.
import express from 'express';
import { createHmac, timingSafeEqual } from 'node:crypto';
const app = express();
const seen = new Set(); // use your database in production
function isGenuine(secret, headers, rawBody) {
const id = headers['webhook-id'], ts = headers['webhook-timestamp'];
const sent = String(headers['webhook-signature'] || '').replace(/^v1,/, '');
if (!id || !ts || Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false; // too old: could be a replay
const key = Buffer.from(secret.replace(/^whsec_/, ''), 'base64');
const want = createHmac('sha256', key).update(id + '.' + ts + '.' + rawBody).digest('base64');
const a = Buffer.from(sent), b = Buffer.from(want);
return a.length === b.length && timingSafeEqual(a, b);
}
// express.raw keeps the body exactly as it was sent, which the signature needs.
app.post('/webhooks/radipay', express.raw({ type: 'application/json' }), (req, res) => {
const raw = req.body.toString('utf8');
if (!isGenuine(process.env.RADIPAY_WEBHOOK_SECRET, req.headers, raw)) return res.status(400).end();
res.status(200).end(); // answer first, work after
const id = req.headers['webhook-id'];
if (seen.has(id)) return; // a repeat: already handled
seen.add(id);
const event = JSON.parse(raw);
if (event.type === 'payment.succeeded' && event.data.subjectType === 'payment_link') {
const linkId = event.data.subjectId.split(':')[0];
// mark the order for linkId as paid
}
});
app.listen(3000);Use the raw body
How to answer
- Answer with any 2xx status within 10 seconds. The body of your answer is ignored.
- Answer first, then do the work. If the work is slow, put the event on a queue.
- Redirects are not followed. Give the final address.
- Anything else (a 4xx, a 5xx, a redirect, no answer in time) counts as a failure and is retried.
Retries
An event is tried up to 8 times over about 45 hours. The first attempt is immediate.
| Attempt | Sent |
|---|---|
| 1 | At once |
| 2 | 1 minute later |
| 3 | 5 minutes later |
| 4 | 30 minutes later |
| 5 | 2 hours later |
| 6 | 6 hours later |
| 7 | 12 hours later |
| 8 | 24 hours later |
After the eighth failure the delivery is marked dead and is not sent again by itself. A person can press Send again on it in the app.
An endpoint that keeps failing is switched off
Repeats and order
- The same event can arrive more than once, for example when your answer was lost on the way back. Record each
webhook-idyou have handled and ignore repeats. - Events can arrive out of order. Do not assume
invoice.issuedreaches you beforeinvoice.paid. If order matters, read the record. - A webhook is a prompt, not the only source of truth. After an outage, read the records you care about to catch up.
Read the delivery log
Everything sent to your endpoints is kept, with your server's answer. A key with integrations.read can read it, which is useful for monitoring and for catching up.
List deliveries
/webhooks/deliveriesPermission integrations.read
Query
statusstringOptionalPENDING,SENDING,SUCCEEDED,FAILED(will be retried, or the endpoint is off) orDEAD(given up).typestringOptional- Only this event type, such as
payment.succeeded. endpointIduuidOptional- Only deliveries to this endpoint.
page, pageSizeintegerOptional- Paging. pageSize may be up to 200 here.
curl https://prod.pay.radingtechnologies.co.ke/webhooks/deliveries?status=DEAD \
-H "Authorization: Bearer $RADIPAY_API_KEY"{
"data": [
{
"id": "6a3f0c2e-…",
"endpointId": "b71d5e90-…",
"eventId": "evt_5f0c2a9e-…",
"type": "payment.succeeded",
"status": "DEAD",
"attempts": 8,
"nextAttemptAt": null,
"lastStatusCode": 503,
"lastError": "HTTP 503",
"durationMs": 412,
"deliveredAt": null,
"createdAt": "2026-12-01T09:15:02.418Z",
"updatedAt": "2026-12-03T05:51:10.004Z"
}
],
"meta": {
"page": 1,
"pageSize": 25,
"total": 1,
"pages": 1
}
}Get one delivery
/webhooks/deliveries/{id}Permission integrations.read
The same record, plus payload (the exact JSON that was sent) and lastResponse (the first 2,048 characters of your server's answer).
List your endpoints
/webhooks/endpointsPermission integrations.read
Each endpoint with its address, events, whether it is switched on, why it was switched off if it was, and how its deliveries went over the last seven days.
{
"data": [
{
"id": "b71d5e90-…",
"url": "https://example.co.ke/webhooks/radipay",
"description": "Billing server",
"events": [
"payment.succeeded",
"payment.failed"
],
"enabled": true,
"failureStreak": 0,
"disabledReason": null,
"createdAt": "2026-11-20T08:00:00.000Z",
"updatedAt": "2026-11-20T08:00:00.000Z",
"last7Days": {
"succeeded": 318,
"failing": 0,
"dead": 0
}
}
]
}