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

nexera-pay

v0.1.1

Published

Nexera Pay — API paiement RDC (Mobile Money + Carte). SDK JavaScript/TypeScript officiel.

Downloads

194

Readme

nexera-pay

npm version npm downloads bundle size license CI

SDK JavaScript/TypeScript officiel pour Nexera Pay — API d'encaissement RDC : Mobile Money (M-Pesa, Airtel Money, Orange Money, Africell) + Carte bancaire (Visa/Mastercard 3-D Secure, PCI DSS SAQ-A). Une seule intégration REST, tous les rails locaux.

Installation

npm install nexera-pay

Quickstart

import { NexeraPay } from "nexera-pay";

const nexera = new NexeraPay({
  apiKey: process.env.NEXERA_PAY_API_KEY!,   // nex_test_... ou nex_live_...
  secret: process.env.NEXERA_PAY_SECRET!,
});

// Créer un paiement Mobile Money (STK)
const payment = await nexera.payments.create({
  amount: 10000,           // 100.00 USD en cents
  currency: "USD",
  method: "mobile_money",
  operator: "mpesa",
  phone: "243812345001",
  reference: "INV-2026-0001",
  description: "Facture #INV-2026-0001",
});

console.log(payment.id, payment.status);   // pay_xxxx  processing

Créer un paiement carte (hosted checkout)

const payment = await nexera.payments.create({
  amount: 50000,
  currency: "USD",
  method: "card",
  reference: "INV-002",
  customer_email: "[email protected]",
  customer_name: "Jean Kabala",
  return_url: "https://monsite.cd/facture/002",
});

// Rediriger le client :
window.location.href = payment.checkout_url!;

Vérifier un webhook

import express from "express";
import { Webhooks } from "nexera-pay";

app.post("/webhooks/nexera", express.raw({ type: "application/json" }), (req, res) => {
  const signature = req.header("X-Nexera-Signature");
  const bodyStr = req.body.toString();

  if (!Webhooks.verifySignature(process.env.NEXERA_WEBHOOK_SECRET!, signature!, bodyStr)) {
    return res.status(401).send("Invalid signature");
  }

  const event = JSON.parse(bodyStr);
  if (event.type === "payment.succeeded") {
    const tx = event.data.object;
    // Marquer la facture tx.reference comme payée dans ta DB
  }
  res.status(200).send("ok");
});

Payout B2C (marchand → client)

const payout = await nexera.payouts.create({
  amount: 100,
  currency: "CDF",
  method: "mobile_money",
  operator: "mpesa",
  phone: "243828584688",
  reference: "REMB-001",
  description: "Remboursement produit défectueux",
});

Refund

// Refund total
await nexera.refunds.create("pay_xxx");

// Refund partiel
await nexera.refunds.create("pay_xxx", { amount: 5000, reason: "Article manquant" });

Balance

const bal = await nexera.balance.get();
console.log(bal.available.USD, bal.available.CDF);   // en cents

Sandbox (mode test)

En mode test (clé nex_test_...), les MSISDN suivants déclenchent des scenarios déterministes :

| MSISDN | Résultat | |--------|----------| | ...001 | Succès en 3s | | ...002 | Failed immédiat | | ...003 | Timeout puis failed (60s) | | ...004 | Failed (wrong PIN) | | ...005 | Succès en 10s |

Gestion d'erreurs

import { NexeraPay, SignatureError, RateLimitError, ValidationError } from "nexera-pay";

try {
  const p = await nexera.payments.create({ ... });
} catch (e) {
  if (e instanceof RateLimitError) {
    console.log(`Rate limited, retry dans ${e.retryAfter}s`);
  } else if (e instanceof ValidationError) {
    console.log("Validation failed:", e.detail);
  } else if (e instanceof SignatureError) {
    // Ta clé/secret est mauvaise ou le timestamp système est décalé
  }
}

Docs complètes

https://docs.nexera.africa/pay

License

MIT