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

malipo-node

v1.1.0

Published

Official Node.js SDK for Malipo Payment Gateway

Downloads

225

Readme

Malipo Node.js SDK

The official Node.js library for the Malipo Payment Gateway. Securely accept Mobile Money payments (Vodacom MPesa, Orange Money, Airtel Money) in the DRC.

Installation

npm install malipo-node
# or
yarn add malipo-node

Quick Start

import { Malipo } from 'malipo-node';

const malipo = new Malipo({
  apiKey: 'sk_test_your_api_key'
});

// Create a charge
try {
  const charge = await malipo.charges.create({
    amount: 10,
    currency: 'USD',
    phone: '243810000000',
    network: 'VODACOM_MPESA',
    description: 'Order #123'
  }, {
    idempotencyKey: 'unique_order_id_123' // Highly recommended
  });

  console.log('Charge initiated:', charge.id);
  console.log('Status:', charge.status); // 'pending'
} catch (error) {
  console.error('Charge failed:', error.message);
}

Features

🔐 Idempotency

Protect against duplicate charges by providing an idempotencyKey in the options. If the request is retried with the same key, the SDK will return the original transaction record.

🔄 Environment Detection

The SDK automatically switches between sandbox and live environments based on your API key prefix (sk_test_ vs sk_live_).

📊 Balance Check

Check your available and pending balances for your current environment.

const balance = await malipo.balance.retrieve();
console.log('Available USD:', balance.available[0].amount);

🔍 Transaction Status

Retrieve the latest status of any transaction.

const transaction = await malipo.transactions.retrieve('tx_123');
console.log('Latest status:', transaction.status);

API Reference

new Malipo(config)

  • apiKey: (Required) Your Malipo secret key.
  • environment: (Optional) sandbox or live. Auto-detected by default.
  • baseUrl: (Optional) Override the default API base URL.

malipo.charges.create(params, options)

  • amount: Number.
  • currency: String (USD or CDF).
  • phone: String (DRC MSISDN format).
  • network: VODACOM_MPESA, ORANGE_MONEY, or AIRTEL_MONEY.
  • idempotencyKey: (Optional) Unique string for request deduplication.

malipo.transactions.retrieve(id)

  • id: Transaction ID.

malipo.balance.retrieve()

  • Returns balance details for the current environment.

malipo.webhooks.constructEvent(payload, signature, secret)

  • payload: Raw string body of the request.
  • signature: The X-Webhook-Signature header value.
  • secret: Your webhook signing secret from the dashboard.
  • Returns: A verified MalipoEvent object or throws an error if verification fails.

Webhooks Example (Express)

app.post('/webhooks/malipo', express.raw({ type: 'application/json' }), (req, res) => {
  const signature = req.header('x-webhook-signature');

  try {
    const event = malipo.webhooks.constructEvent(
      req.body.toString(), 
      signature, 
      process.env.MALIPO_WEBHOOK_SECRET
    );

    if (event.type === 'charge.succeeded') {
      const charge = event.data.object;
      console.log(`Payment successful: ${charge.id}`);
    }

    res.sendStatus(200);
  } catch (err) {
    res.status(400).send(`Webhook Error: ${err.message}`);
  }
});

License

MIT