Momo is an electronic wallet by MTN. Use this package to easily access the MTN MOMO API in sandbox and in live environments.
- From GitHub :
git clone https://github.com/k2pme/MOMO.git
cd MOMO
- With npm :
npm install mtnmomocg
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.
After installing all dependencies using npm install, you can register at the MTN MOMO web site
- sandbox User Provisioning
- collection :
createAccessToken => json ;
createPayment => json ;
requestToPay => json ;
getAcountBalance => json ;
getBasicUserinfo => json ;
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 is an MTN MOMO API product used for remote collection of bills, fees or taxes.
Ressources : Collection
Useful for sandbox users, you can POST
your apiUser and your apikey or GET
Ressource : sandbox User Provisioning
-
required :
-
auth :
for Autorization, provide an object({key : 'value'}) withinapikey(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 withPOST 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'
.
- cache(string) :
- 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();
;
This project is licensed under the LICENSE
It would be so amazing to collaborate with you, Please reach out to me via my email :-)
Clodlin MANTSILA
- github : @k2pme
- email : cmantsila0@gmail.com