You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constapp=require("express")();constMpesa=require("lipanampesa");// create an instance// You can have multiple instances of this e.g for production and developmentconstMpesaApi=newMpesa({consumerKey: "<your consumer key >",consumerSecret: "<your consumer secret >",environment: "<production or sandbox>",shortCode: "< your business shortCode>",lipaNaMpesaShortCode: "< your head office number >",lipaNaMpesaShortPass: "<your online passKey>"});app.get("/test/pay",(req,res)=>{constsenderMsisdn=2547051234567;// customer phone numberconstamount=1000;// amount to be paidconstcallbackUrl="";// webhook receiveing from safaricom, callbackurlconstaccountRef="";// Account RefconstTransactionType="";// "CustomerBuyGoodsOnline" for till and "CustomerPayBillOnline" for paybillMpesaApi.lipaNaMpesaOnline(senderMsisdn,amount,callbackUrl,accountRef,TransactionType).then(res=>console.log(res)).catch(err=>console.error(err));});