Code Monkey home page Code Monkey logo

generatingmpesastkpush's Introduction

Generating an M-Pesa STK (Simtoolkit) push on Safaricom line

M-Pesa STK push is an easy way of making Lipa na M-pesa payment.

Request is initiated from a USSD, Mobile app or any form of web request. All a user is required to do is provide their M-pesa PIN and voila, a C2B mpesa transaction is complete.

First generate your access token.

Set your request headers

setting request headers

Get your test credentials and parameter definitions.

Note: use code provided under Lipa Na Mpesa Online Shortcode for your shortcode.

Make a POST request to:

https://sandbox.safaricom.co.ke/mpesa/stkpush/v1/processrequest

with parameters:

{
    "BusinessShortCode": "Shortcode (6 digits)",
    "Password": "base64.encode(ShortcodePasskeyTimestamp)",
    "Timestamp": "yyyymmddhhiiss",
    "TransactionType": "CustomerPayBillOnline",
    "Amount": "10",
    "PartyA": "MSISDN (12 digits)",
    "PartyB": "Shortcode (6 digits)",
    "PhoneNumber": "MSISDN (12 digits)",
    "CallBackURL": "https://callbackurl",
    "AccountReference": "123456",
    "TransactionDesc": "Testing"
}

Sample request:

sample lipa na mpesa online request

Check your phone asking you to provide M-Pesa PIN to complete transaction:

STK push on phone

generatingmpesastkpush's People

Contributors

kmacharia avatar

Stargazers

Dominic Tanui avatar

Forkers

linscol2020

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.