Skip to content

ondiekelijah/daraja2.0-lipa-na-mpesa-nodejs

Repository files navigation

daraja2.0-lipa-na-mpesa-nodejs

Installation & set up

Clone repo

git clone https://github.com/Dev-Elie/daraja2.0-lipa-na-mpesa-nodejs.git Lipa-na-Mpesa

Install packages & start app

cd Lipa-na-Mpesa
npm install
npm start

Simulate Payment

Endpoint - http://localhost:3000/api/stkPush

Method - POST

Request body(JSON)

{
	"amount": 1,
	"phone": "2547***",
	"Order_ID": "2255"
}

Expected response body

{
	"MerchantRequestID": "*****",
	"CheckoutRequestID": "ws_CO_******",
	"ResponseCode": "0",
	"ResponseDescription": "Success. Request accepted for processing",
	"CustomerMessage": "Success. Request accepted for processing"
}

Payment confirmation

Endpoint - http://localhost:3000/api/confirmPayment/${CheckoutRequestID}

Method - POST

Expected response body

{
	"ResponseCode": "0",
	"ResponseDescription": "The service request has been accepted successsfully",
	"MerchantRequestID": "******",
	"CheckoutRequestID": "ws_CO_*****",
	"ResultCode": "0",
	"ResultDesc": "The service request is processed successfully."
}

Read more.

About

M-Pesa Daraja2.0 API - STK Push & Payment confirmation

Topics

Resources

Stars

Watchers

Forks