npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

zynlepay-node

v0.2.0

Published

Unofficial TypeScript SDK for the ZynlePay payments API (card, mobile money, wallet-to-bank).

Downloads

51

Readme

zynlepay-node

Unofficial TypeScript SDK for the ZynlePay payments API (card deposits, mobile money, wallet-to-bank payouts).

Works with any Node.js 22+ runtime - e.g. Express, AdonisJS, Nuxt server routes, Quasar SSR, or just plain Node. Zero runtime dependencies.

CI Coverage npm version npm downloads License: BSD-3-Clause

TypeScript NodeJS Vitest ESLint Prettier

Contents generated with DocToc

Install

npm install zynlepay-node

Configure

Generate credentials from your ZynlePay merchant dashboard, then construct one client and reuse it:

import { ZynlePayClient } from "zynlepay-node";

const client = new ZynlePayClient({
  merchantId: process.env.ZYNLEPAY_MERCHANT_ID!,
  apiId: process.env.ZYNLEPAY_API_ID!,
  apiKey: process.env.ZYNLEPAY_API_KEY!,
  environment: "sandbox", // omit or use "production" for live payments
});

Never commit credentials to source control.

Usage

Collect a mobile money payment

const result = await client.momoDeposit({
  senderId: "260971234567",
  referenceNo: "ORDER-1001",
  amount: 100,
});
console.log(result.response_code, result.response_description);

The customer approves the payment via a USSD prompt on their phone. The response reports the outcome via response_code / response_description (not status), and the final status arrives at your callback URL — see Handling callbacks.

Send a mobile money payout

const result = await client.momoWithdraw({
  receiverId: "260971234567",
  referenceNo: "PAYOUT-1001",
  amount: 250,
});
console.log(result.response_code, result.response_description);

Pay out to a bank account

const result = await client.walletToBank({
  receiverId: "62123456789",
  bankName: "fnb",
  referenceNo: "PAYOUT-1002",
  amount: 10,
  description: "Invoice 55 payout",
});
console.log(result.response_code); // "120" on success

Accept a card payment

const result = await client.cardDeposit({
  referenceNo: "ORDER-1003",
  amount: 1,
  description: "Order 1003",
  firstName: "Jane",
  lastName: "Banda",
  address: "1 Cairo Rd",
  email: "[email protected]",
  phone: "260971234567",
  city: "Lusaka",
  state: "Lusaka",
  currency: "ZMW",
  zipCode: "10101",
  country: "ZMB",
});

// Redirect the customer to result.redirectUrl to complete the payment
// on the bank's checkout page.

Check a transaction status

const result = await client.paymentStatus({ referenceNo: "ORDER-1001" });
console.log(result.response_code); // "100" success, "990" pending, "995" failed

Check your wallet balances

const result = await client.checkBalance();
console.log(result.disbursement_balance); // payout wallet
console.log(result.collection_balance); // collection wallet

Handling callbacks

ZynlePay sends the final status of every transaction to the callback URL you configure in the merchant dashboard. Use parseCallback to validate the payload:

import { parseCallback } from "zynlepay-node";

// Express example
app.post("/zynlepay/callback", (req, res) => {
  const callback = parseCallback(req.body);
  // callback.referenceNo — your reference
  // callback.responseCode — the raw code, e.g. "100" or "995"
  // callback.status       — normalized: "success" | "failed"
  // callback.raw          — the full payload
  res.sendStatus(200);
});

Error handling

All failures throw ZynlePayError, including network errors, timeouts, non-2xx responses, and API-level failures reported in the response body:

import { ZynlePayError } from "zynlepay-node";

try {
  await client.momoDeposit({ senderId: "260971234567", referenceNo: "R1", amount: 5 });
} catch (error) {
  if (error instanceof ZynlePayError) {
    console.error(error.message, error.httpStatus, error.responseBody);
  }
}

Smoke test

An optional live smoke test exercises the sandbox endpoints with real credentials. It runs the read-only operations by default; set SMOKE_INCLUDE_PAYMENTS=1 to also create a 1-unit momo deposit.

ZYNLEPAY_MERCHANT_ID=... \
ZYNLEPAY_API_ID=... \
ZYNLEPAY_API_KEY=... \
npm run smoke

Documentation

Full guides — including per-operation references and framework recipes for Express, AdonisJS, Nuxt, and Quasar — are available at engineervix.github.io/zynlepay-node.

The docs live in the docs/ directory and are built with VitePress. To run them locally:

npm run docs:dev

Contributing

See CONTRIBUTING.md.

License

BSD-3-Clause. See LICENSE.

This is an unofficial SDK and is not affiliated with or endorsed by ZynlePay.