Skip to Content
ClientsNode.js

Node.js client

Request signing, checkout, payouts and webhooks for TypeScript and JavaScript. Node 20 or later, ESM and CommonJS, with type declarations and no runtime dependencies.

Repository: selcom-developers/selcom-node 

Install

npm i @selcom-developers/selcom

Quickstart

Create an order, then push a USSD prompt to the buyer’s mobile wallet.

import { SelcomClient } from "@selcom-developers/selcom"; const selcom = new SelcomClient({ config: { environment: "sandbox", // required: "sandbox" or "production", there is no default apiKey: process.env.SELCOM_API_KEY!, secret: process.env.SELCOM_API_SECRET!, vendor: process.env.SELCOM_VENDOR!, }, }); // 1. Create an order (non-card), 2. push a USSD prompt to the buyer's wallet. const order = await selcom.createOrderMinimal({ orderId: "ORD-1001", buyerEmail: "buyer@example.com", buyerName: "Test Buyer", buyerPhone: "255700000001", amount: 8000, // whole units; fractions are rejected, never rounded currency: "TZS", // always explicit noOfItems: 1, webhookUrl: "https://example.com/selcom/webhook/<random-token>", }); const push = await selcom.walletPayment({ transid: "TXN-1001", orderId: "ORD-1001", msisdn: "255700000001", }); // push.status is normally "PENDING": the outcome arrives by webhook and is confirmed with orderStatus.

The environment is required and has no default. Every operation returns a result with one of the typed statuses: SUCCESS, PENDING, AMBIGUOUS, FAILED or NOT_FOUND.

The README  covers configuration, every operation, error handling, idempotency, webhooks, signing on its own and replacing the transport.

How it behaves

The client follows the shared spec. These pages explain what it does:

Help and issues

Found a problem, or want to help? Open an issue in the repository , or read Contributing. For security problems, see Security reporting.

Last updated on