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 🙏

© 2025 – Pkg Stats / Ryan Hefner

hubtelpayment

v1.1.7

Published

Hubtel payments for Node.js

Readme

Hubtel Merchant Account integration for Node Js

Based on https://developers.hubtel.com/documentations/merchant-account-api

About

The hubtelpayment package allows you to accept and process payments using Hubtel Merchant Account API directly in your Node js application.

Features

  • Receive mobile money
  • Send mobile money
  • Check status of transaction
  • Online checkout

Installation and Configuration

Install using npm install hubtelpayment --save


const Hubtel =  require('hubtelpayment');

const MerchantAccount = Hubtel.MerchantAccount; 
const OnlineCheckout = Hubtel.OnlineCheckout; 

// you may store and fetch these sensitive details in a config file.
const config = {
    account_number:'<account number>', 
    client_id : '<client id >', 
    client_secret :'<client_secret>'
};

let ma = new MerchantAccount(config);

Using Online Checkout feature

Let's say you are using this feature from a checkout method, you can do it like so:


// online checkout request

// sample order
 const order = {
     total : 70.00,
     items : [
        {
            name : "Bathing soap",
            description : "Bathing soap",
            quantity : 1,
            price : 50.00,
        },
        {
            name : "Washing soap",
            description : "Washing soap",
            quantity : 1,
            price : 20.00,
        }
     ]
 }

 // Initiate online checkout
 ocRequest = new OnlineCheckout.Request();
 ocRequest.invoice.description = "Invoice description";
 ocRequest.invoice.total_amount = order.total;
 ocRequest.store.name = "My Shop";
 ocRequest.store.logo_url = 'https://cb.mysite.com/img/logo.png';
 ocRequest.store.phone = "0243XXXXXX";
 ocRequest.store.postal_address = "P. O. Box 123456";
 ocRequest.store.tagline = "Best online shop ever";
 ocRequest.store.website_url = 'https://cb.mysite.com';
 ocRequest.actions.cancel_url = 'https://cb.mysite.com/callback';
 ocRequest.actions.return_url = 'https://cb.mysite.com/callback';


 order.items.forEach((item) => {
     invoiceItem = new OnlineCheckout.Item();
     invoiceItem.name = item.name;
     invoiceItem.description = item.description;
     invoiceItem.quantity = item.quantity;
     invoiceItem.unit_price = item.price;
     invoiceItem.total_price = item.price * item.quantity;
     ocRequest.invoice.addItem(invoiceItem);
 });

 ma.onlineCheckout(ocRequest)
 .then( (res) => {
     // you can redirect the user from here
    console.log(res.data);
}).catch( error => {
    console.log(error.response.data , error.response.status);
});

//  check invoice status
ma.checkInvoiceStatus('4bb4393e394343ce')
.then( (res) => {
    console.log(res.data);
}).catch( error => {
    console.log(error.response.data , error.response.status);
});

Receive Mobile Money

Here is how you request mobile money payment from say a checkout method:


// receive money 
ma.receiveMobileMoney({
    CustomerName :"test" , 
    CustomerEmail: "n/a", 
    CustomerMsisdn : '23324XXXXXXX',
    Channel:'mtn-gh',
    Amount : 0.5,
    ClientReference:'',
    Description:'test debit',
    PrimaryCallbackUrl : 'https://cb.mysite.com/callback',
    SecondaryCallbackURL : 'https://cb.mysite.com/callback'
})
.then( (res) => {
    console.log(res.data);
}).catch( error => {
    console.log(error.response.data , error.response.status);
});

License

Released under the MIT License, see LICENSE.