CEND / Developers / Webhooks and test mode
Signed · retried · loggedWebhooks and test mode.
Hear about every delivery as it moves, and try everything with pretend deliveries first.
Set up a webhook
- 1.In Developers, open Webhooks and add an https address (up to five). It must be a public address.
- 2.Choose the events you want, or leave it on all of them.
- 3.Copy the secret. It is shown to you so you can check that calls really come from CEND.
- 4.Answer every call with any 2xx status within 10 seconds.
Events
- shipment.booked The delivery is booked and paid, waiting to be picked up.
- shipment.picked_up The courier has the parcel.
- shipment.at_hub The parcel is at a CEND office.
- shipment.in_transit The parcel is on its way.
- shipment.out_for_delivery The parcel is out for delivery.
- shipment.delivered The parcel was delivered.
- shipment.failed_attempt A delivery attempt failed.
- shipment.on_hold The delivery is on hold.
- shipment.returned The parcel is being returned.
- shipment.cancelled The delivery was cancelled.
- booking.failed A shopper’s payment did not go through (they can try again).
- booking.expired A shopper did not pay in time, so the booking was closed.
- booking.needs_review A shopper paid and CEND is finishing the delivery by hand.
What a call looks like
Every call has the same shape: an event id, its type, whether it came from live or test, and the shipment. Names, phone numbers and addresses are never sent. Use the shipment id or your own order_reference to find the order.
POST https://your-shop.example.com/cend-webhook
CEND-Signature: t=1763265600,v1=5b1f...c2e9
Content-Type: application/json
{
"id": "5f0c1b2e-7d3a-4c1e-9b8a-2a6e4d1f0c33",
"type": "shipment.delivered",
"created_at": "2026-11-16T04:40:00+01:00",
"livemode": true,
"data": {
"shipment": {
"id": "0b9c4a5e-...",
"reference": "RD482916307",
"status": "delivered",
"previous_status": "out_for_delivery",
"price_minor": 800000,
"currency": "NGN",
"paid": true,
"tracking_url": "https://cend.ng/track?code=RD482916307",
"order_reference": "ORDER-1001"
}
}
}Check that it came from CEND
Every call carries a CEND-Signature header: t=<time>,v1=<signature>. The signature is an HMAC-SHA256 of the time, a dot and the raw body, made with your secret. Check it against the raw body (before it is parsed as JSON) and refuse calls older than five minutes.
import crypto from 'node:crypto';
function isFromCend(rawBody, header, secret) {
const [t, v1] = header.split(',').map((part) => part.split('=')[1]);
const expected = crypto.createHmac('sha256', secret).update(t + '.' + rawBody).digest('hex');
const fresh = Math.abs(Date.now() / 1000 - Number(t)) < 300;
return fresh && crypto.timingSafeEqual(Buffer.from(v1), Buffer.from(expected));
}<?php
// $raw is the request body exactly as received (file_get_contents("php://input")).
$header = $_SERVER["HTTP_CEND_SIGNATURE"] ?? "";
parse_str(str_replace(",", "&", $header), $parts);
$expected = hash_hmac("sha256", ($parts["t"] ?? "") . "." . $raw, $secret);
$fresh = abs(time() - (int) ($parts["t"] ?? 0)) < 300;
if (! $fresh || ! hash_equals($expected, $parts["v1"] ?? "")) {
http_response_code(400);
exit;
}import hashlib, hmac, time
def is_from_cend(raw_body: bytes, header: str, secret: str) -> bool:
parts = dict(piece.split("=", 1) for piece in header.split(","))
signed = parts["t"].encode() + b"." + raw_body
expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
fresh = abs(time.time() - int(parts["t"])) < 300
return fresh and hmac.compare_digest(expected, parts["v1"])Retries and the call log
- If your address does not answer with a 2xx, we try again after 1 minute, 5 minutes, 30 minutes, 2 hours and 6 hours.
- The same event can arrive more than once. Use the event id to ignore a repeat.
- An address that fails ten whole deliveries in a row is switched off, and you are told. Fix your end and switch it back on in Developers.
- Developers shows every call with what your address answered, and you can send any of them again.
Test mode
A test key checks everything a live key does, but books a pretend delivery. Nothing real moves: no courier, no money, no reports. It is how you try your webhooks without waiting for a real parcel.
- The answer has test: true and a reference that starts TEST-.
- Each pretend delivery moves by itself every two minutes: booked, picked up, in transit, out for delivery, delivered. Every move calls your webhooks, with livemode set to false.
- Do not want to wait? Call POST /business/shipments/{id}/advance with a test key to move it to the next stage at once, or to a stage you name. A live key gets a 404 there.
- In your CEND account, the Test bookings area lets you book a pretend delivery with a click and watch it move, with no code at all.
Stuck, or want something changed?
Tell us what you are building and we will reply within one working day.