DroplineDevelopers

Webhooks

Dropline sends a signed HTTPS request to your server when one of your orders, payments, payouts or invoices changes, so your shop or system stays up to date without asking.

Set it up

  1. In the Dropline merchant dashboard, open Webhooks and enter your endpoint. It must be https:// and reachable from the internet.
  2. Copy the signing secret. It's shown once; you can rotate it any time.
  3. Press Send test: you get a ping event.
  4. Check the signature on every request (below), answer with any 2xx status within 10 seconds, then do your work.

Events

Orders (each status once, in order)

order.pendingBooked and waiting for a courier to accept.
order.assignedA courier accepted and gave it to a rider.
order.en_route_pickupThe rider is on the way to the pickup.
order.picked_upThe rider has the parcel (they scanned the label or entered the pickup code).
order.in_transitOn the way to the drop-off.
order.arrivedThe rider is at the drop-off.
order.deliveredDelivered.
order.failedCouldn't be delivered.
order.cancelledCancelled. Online payments are refunded in full automatically.

Money

payment.succeededA payment for one of your orders or invoices went through.
payment.refundedSome or all of a payment was refunded (see refundedNow and full).
payout.paidCash collected on delivery was sent to your mobile money.
payout.failedA payout couldn't be sent; the money is back in your balance.
invoice.issuedYour monthly invoice for "Dropline account" deliveries is ready.
invoice.paidAn invoice was paid.

The request

A POST with a JSON body and these headers:

X-Dropline-EventThe event type, e.g. order.delivered.
X-Dropline-DeliveryUnique id of this event. The same id is used on retries: use it to ignore repeats.
X-Dropline-TimestampWhen it was signed, in Unix seconds.
X-Dropline-Signaturet=<timestamp>,v1=<hex HMAC-SHA256 of "<timestamp>.<raw body>" with your secret>

Order example

{
  "type": "order.delivered",
  "createdAt": "2026-10-16T14:40:12.000Z",
  "data": {
    "id": "cmv5…",
    "trackingNumber": "DL-8KQ2M4XP",
    "status": "DELIVERED",
    "price": 45,
    "bookingFee": 1,
    "currency": "GHS",
    "codAmount": 0,
    "paymentMethod": "MOBILE_MONEY",
    "riderName": "Kofi Mensah",
    "pickupAddress": "Opposite Shell filling station, Spintex Road",
    "dropoffAddress": "House 14, Nii Okaiman Street, East Legon",
    "updatedAt": "2026-10-16T14:40:11.000Z"
  }
}

Payout example

{
  "type": "payout.paid",
  "createdAt": "2026-10-17T09:02:44.000Z",
  "data": {
    "id": "cmv7…",
    "reference": "DLO-4F2A9C1E7B3D8A60",
    "amount": 1250.5,
    "currency": "GHS",
    "status": "PAID",
    "network": "MTN",
    "phoneEndsWith": "567",
    "paidAt": "2026-10-17T09:02:43.000Z"
  }
}

Check the signature

Recompute the HMAC over timestamp + "." + raw body with your secret and compare it with v1 in constant time. Reject requests older than 5 minutes. Use the raw body: re-serialising the JSON changes the bytes.

Node.js (Express)

import crypto from "node:crypto";
import express from "express";

const app = express();
const SECRET = process.env.DROPLINE_WEBHOOK_SECRET; // from your dashboard, shown once

// Use the raw body: the signature covers the exact bytes we sent.
app.post("/dropline/webhooks", express.raw({ type: "application/json" }), (req, res) => {
  const header = req.get("X-Dropline-Signature") ?? "";
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
  const signed = `${parts.t}.${req.body.toString("utf8")}`;
  const expected = crypto.createHmac("sha256", SECRET).update(signed).digest("hex");

  const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300; // 5 minutes
  const valid = parts.v1 && expected.length === parts.v1.length &&
    crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
  if (!fresh || !valid) return res.sendStatus(400);

  const event = JSON.parse(req.body.toString("utf8"));
  // X-Dropline-Delivery is unique per event: skip ones you've already handled.
  res.sendStatus(200); // answer fast, then do the work
  handle(event);
});

Python (Flask)

import hmac, hashlib, os, time, json
from flask import Flask, request, abort

app = Flask(__name__)
SECRET = os.environ["DROPLINE_WEBHOOK_SECRET"].encode()

@app.post("/dropline/webhooks")
def webhooks():
    parts = dict(p.split("=", 1) for p in request.headers.get("X-Dropline-Signature", "").split(","))
    signed = f"{parts.get('t')}.".encode() + request.get_data()
    expected = hmac.new(SECRET, signed, hashlib.sha256).hexdigest()
    if abs(time.time() - int(parts.get("t", 0))) > 300 or not hmac.compare_digest(expected, parts.get("v1", "")):
        abort(400)
    event = json.loads(request.get_data())
    return "", 200

PHP

<?php
$secret = getenv('DROPLINE_WEBHOOK_SECRET');
$body = file_get_contents('php://input');
parse_str(str_replace(',', '&', $_SERVER['HTTP_X_DROPLINE_SIGNATURE'] ?? ''), $parts);
$expected = hash_hmac('sha256', $parts['t'] . '.' . $body, $secret);
if (abs(time() - (int) $parts['t']) > 300 || !hash_equals($expected, $parts['v1'] ?? '')) {
  http_response_code(400);
  exit;
}
$event = json_decode($body, true);
http_response_code(200);

Retries

If your server doesn't answer with a 2xx within 10 seconds, we try again after 10 seconds, 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours, 12 hours: about a day in all. After that the event is marked failed; you can resend it from the delivery log in your dashboard. Events can arrive more than once and, rarely, out of order: rely on X-Dropline-Delivery and the status in the body.