Delivery API for couriers

When a shop sends an order with your service, nxtPay books it with you and you tell nxtPay how it is going. The shopper follows it in nxtPay, and the order is only marked delivered with the shopper's 4-digit hand-over code.

Two ways to work with nxtPay

You areHow it worksIntegration
A small courier or a boda riderFor each delivery the shop sends you a link (WhatsApp or copy). It opens in any phone browser: pickup, drop-off, then Picked up, On the way, Delivered with the customer's code. The link ends once delivered, or after 3 days.None. Ask us to list you.
A courier with your own systemnxtPay books through your API and you post status updates back, both signed.This page

To be listed either way, email business@nxtlaunch.tech with your name, phone, the areas you cover and a price note (for example "from UGX 5,000"). Couriers with a system also send their API address; we agree a partner code and exchange a shared secret privately.

1. Bookings: nxtPay calls you

POST {your-base-url}/bookings
Content-Type: application/json
X-NxtPay-Signature: sha256=3f1c…(hex HMAC-SHA256 of the raw body)

{
  "requestId": "d00f871b-1a4c-4be0-9012-ee937132d170",
  "orderNumber": "461484E4",
  "pickup":  { "name": "Shop name", "phone": "256700000000", "address": "Plot 3, Kampala Road, Kampala" },
  "dropoff": { "name": "Customer name", "phone": "256700000000", "address": "Plot 4, Ntinda Road, Kampala" },
  "callbackUrl": "https://pay.nxtlaunch.tech/api/delivery/webhook/{your-partner-code}",
  "itemsSummary": "1 × Smartphone case"
}

Reply with your tracking reference. A rider, if you already know one, is shown to the shop and the shopper.

200 OK
{
  "tracking_reference": "KB-48213",
  "tracking_url": "https://track.example.ug/KB-48213",
  "rider": { "name": "Musa K.", "phone": "256700111222", "eta": "35 min" }
}
  • Answer within 15 seconds with a 2xx. Anything else, or no tracking_reference, counts as a failed booking and the shop can choose another courier.
  • requestId is unique per booking; use it to ignore repeats.
  • Phone numbers are in international form without the plus: 2567….

Cancelling

If the shop cancels, nxtPay calls POST {your-base-url}/bookings/{tracking_reference}/cancel with an empty JSON body ({}), signed the same way.

2. Status updates: you call nxtPay

POST https://pay.nxtlaunch.tech/api/delivery/webhook/{your-partner-code}
Content-Type: application/json
X-NxtPay-Signature: sha256=…

{
  "event_id": "evt_01J9Z4K2",
  "tracking_reference": "KB-48213",
  "status": "delivered",
  "handover_code": "4821",
  "note": "Handed to the customer"
}
StatusWhen
acceptedA rider is assigned. Send rider with name, phone and ETA.
picked_upCollected from the shop.
in_transitOn the way to the shopper.
deliveredHanded over. Must include handover_code, the 4 digits the shopper gives the rider.
failedCouldn't deliver. Put the reason in note; the order goes back to the shop to resend.
cancelledYou cancelled the booking.

Replies

CodeMeaning
200Applied, or a repeat of an event_id already applied (safe to retry).
401Signature missing or wrong, or the body isn't valid (unknown status, no event_id).
404Unknown or switched-off partner code.
422Refused, e.g. a wrong hand-over code. The body says why and how many tries are left (attempts_left). Five wrong codes lock it for 30 minutes.

3. Signatures

Every request in both directions carries X-NxtPay-Signature: sha256=<hex>, the HMAC-SHA256 of the raw request body with your shared secret. Compute it over the exact bytes sent, before any JSON parsing, and compare in constant time.

import { createHmac } from "node:crypto";

// body = the exact bytes you send (or received); secret = your shared secret
const signature = "sha256=" + createHmac("sha256", secret).update(body).digest("hex");
  • Never put the secret in a URL, an app or a public repository. If it leaks, tell us and we rotate it.
  • Use a fresh event_id for each update. Retry on network errors or 5xx with the same event_id.

Testing

We set you up on our staging environment first, with a test partner code and secret. Book from a test shop, send each status, try a wrong hand-over code, and check the shopper's tracking page. We switch you on in production once that passes.

Privacy

Use customer names, phones and addresses only to deliver the order, and delete them when you no longer need them, in line with Uganda's Data Protection and Privacy Act. Hand-over codes are shown only to the shopper; never ask a shop for one.