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 🙏

© 2024 – Pkg Stats / Ryan Hefner

mtnmomocollection

v2.4.0

Published

MTN MOMO Nodejs package

Downloads

19

Readme

MOMO

Momo is an electronic wallet by MTN. Use this package to easily access the MTN MOMO API in sandbox and in live environments.

Setup

  • From GitHub :
git clone https://github.com/k2pme/MOMO.git   
cd MOMO    
  • With npm :
npm install mtnmomocollection

Or do you wanna test ?

git clone https://github.com/k2pme/MOMO.git   
cd MOMO 
npm install
npm test 

After that, edit the Test File. See an exemple below.

Usage

After installing all dependencies using npm install, you can register at the MTN MOMO web site

Functions

  • sandbox User Provisioning
  • collection :

createAccessToken => json ;
createPayment => json ;
requestToPay => json ;
getAcountBalance => json ;
getBasicUserinfo => json ;

Dir structure

    Projects/MTN_momo/
    ├── lib
    │   ├── products
    |   |   ├── collection.js
    |   |   ├── userProvisioning.js
    │   └── utils
    |       ├── fonctions.js
    ├── .gitignore
    ├── index.js
    ├──LICENSE
    ├──momo.test.js
    ├──package-lock.json
    ├──package.json 

Collection

collection is an MTN MOMO API product used for remote collection of bills, fees or taxes.

Ressources : Collection

userProvisioning

Useful for sandbox users, you can POST your apiUser and your apikey or GET

Ressource : sandbox User Provisioning

parameters :

  • required :

    • auth :
      for Autorization, provide an object({key : 'value'}) within

      apikey(string) : your api key generate from user provisionning
      apiUser(string) : your user ID in UUID4 format.

    • subscriptionKey(string) :
      your Ocp-Apim-Subscription-Key

    • uuid(string) :
      an UUID4

    • accessToken(string) :
      your token create with POST CreateAccessToken

  • not required :

    • cache(string) :
      your cache option;
      default : 'no-cache'
    • root(string) :
      your root URI;
      default : 'https://sandbox.momodeveloper.mtn.com'
    • body :
      useful in some cases, provide yours in json object format in live session
      {'key' : 'value'}
    • env :
      for X-Target-Environment; default : 'sandbox' .

Examples :

  • Test program
const {collection} = require('mtnmomocollection');


test('test1', async ()=>{

    const auth = {
        apiKey : '9481875d16d84243936834c6f01badf6', 
        apiUser : 'de1355f7-d09e-467d-a37e-b38a704cfd87'
    };

    const subscriptionKey = '42e819df23934e7799c45cc42cb275c4';

    const rep = await collection.createAccessToken(auth, subscriptionKey);

    if(rep){
        console.info(rep);
    }

});
  • Create an access token
const {collection} = require('mtnmomocollection');


const myfunc : async ()=>{

    const auth = {
        apiKey : '9481875d16d84243936834c6f01badf6', 
        apiUser : 'de1355f7-d09e-467d-a37e-b38a704cfd87'
    };

    const subscriptionKey = '42e819df23934e7799c45cc42cb275c4';

    const rep = await collection.createAccessToken(auth, subscriptionKey);

    if(rep){
        console.info(rep);
    }

}

myfunc();
;

Licence

This project is licensed under the LICENSE

Contributions

It would be so amazing to collaborate with your, Please reach out to me via my email :-)

Author

Clodlin MANTSILA