git clone https://github.com/Dev-Elie/daraja2.0-lipa-na-mpesa-nodejs.git Lipa-na-Mpesa
cd Lipa-na-Mpesa
npm install
npm start
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"
}
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."
}