← All packages

@lacspace/courier

v1.0.0Commerce & Ledger0 deps

Courier / last-mile delivery toolkit — canonical delivery state machine, Pathao (Nepal) adapter, and inbound webhook verification + status normalization. Zero-dependency, isomorphic.

npm i @lacspace/courier

Usage

courier.ts
import { createPathaoAdapter, verifyPathaoWebhook, parsePathaoWebhook } from "@lacspace/courier";

const pathao = createPathaoAdapter({ clientId, clientSecret, username, password, storeId: 42 });

const shipment = await pathao.createOrder({
  recipientName: "Sita", recipientPhone: "98xxxxxxxx",
  recipientAddress: "Baneshwor, KTM", amountToCollect: 250000, itemQuantity: 1,
});

// inbound webhook -> canonical status, no more manual clicking
if (verifyPathaoWebhook({ headerSecret: req.headers["x-pathao-signature"], expectedSecret })) {
  const evt = parsePathaoWebhook(req.body); // { status: "delivered", consignmentId, ... }
}

Exports 11

createPathaoAdaptertransitioncanTransitionisTerminalnormalizePathaoStatusparsePathaoWebhookverifyPathaoWebhookverifyWebhookSignatureDELIVERY_TRANSITIONSPATHAO_STATUS_MAPCourierError

Keywords

courierlogisticsdeliverypathaonepalwebhook

More in Commerce & Ledger