Giter Club home page Giter Club logo

node-pesa's Introduction

Node pesa

npm (scoped) NPM

node pesa

Integration that simplifies access to M-Pesa's OpenAPI for developers to build applications/ software by providing easy access to services like Customer to Business (C2B), Query, and more.

Report Bug Β· Request Feature

🚧 Documentation

Take a look at the API docs here.

πŸš€ Getting Started

  1. Sign up for OpenAPI Portal – Before you begin, you need to sign up for an account and retrieve your credentials.

  2. Minimum requirements – To run the SDK, your system will need to meet the minimum requirements, including having Node >= 10.1.

  3. Install the SDK – Using NPM is the recommended way to install the Pesa SDK for JS. The SDK is available via [NPM] under the openpesa/pesa-js package. You can run the following in the base directory of your project to add the SDK as a dependency:

    npm install openpesa/pesa-js

    Please see the Installation section of the User Guide for more detailed information about installing the SDK through Composer and other means.

  4. Using the SDK – The best way to become familiar with how to use the SDK is to read the User Guide.

πŸ’Ό Usage

import { Pesa } from '@openpesa/pesa-js';

// Populate the credentials
const api_key = 'your_api_key';
const public_key = 'the_public_key';

// Intiate with credentials
let pesa = new Pesa({ api_key, public_key });

// Setup the transaction
let data = {
    input_Amount: 10000,
    // ..
};

// Execute the transaction
pesa.c2b(data)
    .then((data) => {
        // Print results
        console.log(data);
    })
    .catch((e) => {
        console.log('err: ' + e);
    });

πŸ§ͺ Test

npm test

πŸ—ΊοΈ Road Map

  1. Validate data input using Regex before the API call.
  2. If fields are not provided then generate a random string for "input_ThirdPartyConversationID" and "input_TransactionReference"
  3. Allow optional input for not required fields in a request.
  4. Check and Throw an error when used outside of Node.js due to security reasons, Advice on use outside Node.js.
  5. Validate Secret Keys length and format.
  6. Allow user use custom sessionID on any/each transaction. (Portal allow for seesion with several hours of validity)
  7. Add and improve documentation and examples(example will include expressjs app)

πŸ“œ Changelog

Please see CHANGELOG for more information on what has changed recently.

🀝 Contributing

Please see CONTRIBUTING for details.

πŸ” Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

πŸ‘₯ Credits

πŸ“„ License

The MIT License (MIT). Please see License File for more information.

node-pesa's People

Contributors

alphaolomi avatar baharajr avatar fotiemconstant avatar iamkk11 avatar makindajack avatar reubenwedson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

node-pesa's Issues

disable use outside nodejs

Check and Throw an error when used outside of Node.js due to security reasons, Advice on use outside Node.js.

Re-structure the API design

From

  • Forodha class
    -contructor(options, env, client)
    -encrypt_key
    -get_session
    -query
    -transact

To

  • Pesa class
    -contructor(options, env, client)
    -encrypt_key
    -get_session
    -c2b
    -b2c
    -b2b
    -query
    -reverse

rename package name

This package was intended for Node Enviroment this is to run in a controlled backend environment

After several communication with users

Current name pesa-js implies this packages can be used for frontend/browser enviroment

Current suggested name is node-pesa

TOdo

  • rename repo
  • rename in docs
  • submit package with new name to npmjs
  • abandon old name

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.