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

mobilenig

v2.0.1

Published

A package designed to quickly handle Mobilenig Enterprise services, providing a seamless integration with a range of discounted offerings, including airtime, data, cable TV subscriptions, electricity payments, and exam pins in Nigeria. This package is ide

Readme

MobileNIG Enterprise Node.js SDK

A robust, secure, and fully type-safe Node.js package for integrating MobileNIG Enterprise services. Seamlessly purchase discounted mobile offerings and pay utility bills in Nigeria.

This SDK is fully backward compatible with Version 1 of this package while introducing a modern, modular design for enterprise workflows.

Features

  • Zero Dependencies: Built on Node.js's native fetch (requires Node 18+).
  • TypeScript Ready: Full type definitions (index.d.ts) included out of the box.
  • Robust Network Resilience: Built-in automatic request retries and timeouts for network safety.
  • Flexible Configuration: Initialize keys programmatically or fall back to environment variables.
  • Complete Endpoint Coverage: Airtime, data, cable TV, electricity, and exam PINs (WAEC, NECO, JAMB).

Installation

npm install mobilenig

Environment Variables (Optional)

You can set these environment variables to configure the SDK without hardcoding keys:

MOBILENIG_PUBLIC_KEY=your_public_key
MOBILENIG_SECRET_KEY=your_secret_key
MOBILENIG_BASE_URL=https://enterprise.mobilenig.com/api/v2/  # Optional

Quick Start (Modern API)

const Mobilenig = require('mobilenig');

// Fallback to environment variables if keys are omitted
const mobilenig = new Mobilenig();

async function run() {
  try {
    // 1. Check Balance
    const balanceRes = await mobilenig.control.getBalance();
    console.log(`Current Balance: ${balanceRes.details.balance}`);

    // 2. Buy Airtime
    const airtimeRes = await mobilenig.recharges.buyAirtime({
      service_id: 'BAD', // MTN
      trans_id: 'unique_tx_12345',
      service_type: 'STANDARD',
      phoneNumber: '08030000000',
      amount: 100
    });
    console.log('Airtime Transaction status:', airtimeRes.details.status);
  } catch (error) {
    console.error('Request failed:', error.message);
  }
}

run();

Backward Compatibility (Version 1 Support)

All methods from the original SDK remain fully supported with unchanged signatures, return formats, and error behaviors:

Check Wallet Balance

const balance = await mobilenig.getBalance();
console.log(`Balance: ${balance}`); // returns number or error object

Buy Data

await mobilenig.buyData({
  phoneNumber: '08123456789',
  network: 'mtn',
  amount: 273,
  value: '1GB',
  trans_id: 'tx_987654321',
  service_type: 'SME'
});

Buy Electricity

await mobilenig.buyLight({
  service: 'ikejaPrepaid',
  amount: 1000,
  meter_number: '04042404048',
  trans_id: 'tx_88776'
});

Query Transaction Status

const details = await mobilenig.query_trans('tx_88776');
console.log('Transaction Details:', details);

Modern API Reference (v2 Modules)

For a cleaner separation of concerns, the SDK exposes two distinct sub-services:

mobilenig.control

Exposes account management, wallet status, and service health endpoints.

  • getBalance(): Get wallet balance.
  • getUniqueAccountDetails(): Get virtual account details for wallet funding.
  • getWalletHistory(page, perPage): Retrieve transaction log.
  • searchWalletHistory(transId): Search log by transaction ID.
  • getServicesStatus(serviceId, requestType): Check if a provider is online.

mobilenig.recharges

Exposes raw billing operations. Allows separate validation and recharge calls.

  • validateCustomer({ service_id, customerAccountId, requestType }): Validates smartcard/meter numbers.
  • getPackages({ service_id, requestType }): Fetches available variations and prices.
  • recharge(payload): Submits custom raw transaction payloads.
  • queryTransaction(transId): Checks transaction status.
  • buyAirtime({ service_id, trans_id, service_type, phoneNumber, amount })
  • buyData({ service_id, trans_id, service_type, beneficiary, code, amount })
  • buyCable({ service_id, trans_id, smartcardNumber, amount, productCode, customerName })
  • buyEducation({ service_id, trans_id, quantity, amount, productCode })
  • buyJamb({ trans_id, confirmationCode, phoneNumber, productCode, amount })
  • buySpectranet({ trans_id, productCode, quantity, amount })

Error Handling

The modern endpoints throw detailed, structured errors:

const { 
  MobilenigError, 
  MobilenigValidationError, 
  MobilenigNetworkError 
} = require('mobilenig/src/errors');

try {
  await mobilenig.recharges.buyAirtime({ ... });
} catch (error) {
  if (error instanceof MobilenigValidationError) {
    console.error('Invalid parameters:', error.message);
  } else if (error instanceof MobilenigNetworkError) {
    console.error(`Network status ${error.statusCode}:`, error.message);
  } else {
    console.error('API Error:', error.message);
  }
}

License

MIT License. Developed by Ezekiel Adejobi.