Francis-Mwaniki / mpesa_stk_push-Nodejs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

what you need to have

  • consumer key
  • consumer secret
  • passkey

how to get them

  • consumer key and consumer secret
    • go to developer portal

    • create an app

    • get consumer key and consumer secret

    • passkey

    • go to developer portal

    • click on the api you want to use select Mpesa Express Sandbox

how to use

  • clone the repo
    • cd into the repo
    • run npm install
    • run npm start
    • open your favourite testing tool and make a post request to http://localhost:3000/stkpush
    • pass the following in the body of the request if you wanna post to sandbox or you can use my function to push an stk push
    • { "BusinessShortCode": "174379", "Password": "Mpesa2019", "Timestamp": "20190127101010", "TransactionType": "CustomerPayBillOnline", "Amount": "1", "PartyA": "254708374149", "PartyB": "174379", "PhoneNumber": "254708374149", "CallBackURL": "https://yourdomain.com/", "AccountReference": "test", "TransactionDesc": "test" }
  • you should get a response like this - [x] { "MerchantRequestID": "12345-54321-2", "CheckoutRequestID": "ws_CO_27120190101010101", "ResponseCode": "0", "ResponseDescription": "Success. Request accepted for processing", "CustomerMessage": "Success. Request accepted for processing" }
  • you should get a confirmation message on your phone

About


Languages

Language:JavaScript 100.0%