@lykmapipo/tz-mpesa-ussd-push

0.6.37 • Public • Published

tz-mpesa-ussd-push

Build Status Dependencies Status

Vodacom Tanzania USSD Push API Client.

Requirements

Installation

npm install --save @lykmapipo/tz-mpesa-ussd-push

Usage

const { charge, parseHttpBody } = require('@lykmapipo/tz-mpesa-ussd-push');
const app = require('@lykmapipo/express-common');

// charge customer
const options = { msisdn: '255754001001', amount: 1500, reference: 'A5FK3170' };
charge(options, (error, response) => { 
// => { 
// =>  session: ..., transaction: ..., token: ..., 
// =>  reference: ..., status: ..., result: { ... } 
// => }
});

// register webhook to listen for ussd result
app.all('/v1/webhooks/tz/mpesa/ussd-push', parseHttpBody(), (request, response, next) => {
// => { 
// =>  transaction: ..., token: ..., reference: ..., 
// =>  receipt: ..., status: ..., result: { ... }, isSuccessful: true 
// => }
});

Environment

TZ_MPESA_USSD_PUSH_USERNAME=
TZ_MPESA_USSD_PUSH_PASSWORD=
TZ_MPESA_USSD_PUSH_BUSINESS_NAME=
TZ_MPESA_USSD_PUSH_BUSINESS_NUMBER=
TZ_MPESA_USSD_PUSH_CALLBACK_URL=
TZ_MPESA_USSD_PUSH_LOGIN_EVENT_ID=2500
TZ_MPESA_USSD_PUSH_REQUEST_EVENT_ID=40009
TZ_MPESA_USSD_PUSH_REQUEST_COMMAND=CustomerPaybill
TZ_MPESA_USSD_PUSH_BASE_URL=
TZ_MPESA_USSD_PUSH_LOGIN_PATH=
TZ_MPESA_USSD_PUSH_REQUEST_PATH=
TZ_MPESA_USSD_PUSH_CURRENCY=TZS
TZ_MPESA_USSD_PUSH_CONTENT_TYPE=text/xml
TZ_MPESA_USSD_PUSH_ACCEPT=text/xml
TZ_MPESA_USSD_SSL_CA_FILE_PATH=
TZ_MPESA_USSD_SSL_CERT_FILE_PATH=
TZ_MPESA_USSD_SSL_KEY_FILE_PATH=
TZ_MPESA_USSD_SSL_PASSPHRASE=

Test

  • Clone this repository

  • Install all dependencies

npm install
  • Then run test
npm test

Contribute

It will be nice, if you open an issue first so that we can know what is going on, then, fork this repo and push in your ideas. Do not forget to add a bit of test(s) of what value you adding.

Licence

The MIT License (MIT)

Copyright (c) 2019 lykmapipo & Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Package Sidebar

Install

npm i @lykmapipo/tz-mpesa-ussd-push

Weekly Downloads

3

Version

0.6.37

License

MIT

Unpacked Size

70.8 kB

Total Files

10

Last publish

Collaborators

  • lykmapipo