LIPA NA M-PESA PAYMENT INTERGRATION
Mpesa is a mobile money payment service by Safaricom based in Kenya. It was released in 2007 and since then it has become the common means of payment in Kenya. To help developers implement Mpesa in their platforms, Safaricom released the Daraja API.
Have a Kenyan based Safaricom phone number.
Have Node.js installed on your computer.
Have some basic knowledge of JavaScript and Express JS.
Creating a Safaricom developer account.
Creating-an-app.
Getting an Oauth token.
Lipa na Mpesa online.
Safaricom controls all the operations concerning Mpesa and Daraja API. For you to access Daraja API, you need to have a developer account. The following steps explain how you can create a developer account. Feel free to skip if you already have one.
Step 1: The first step is to proceed to Safaricom Developer website.
Step 2: Click on the signup button on the center or visit directly from here. Proceed to the signup section.
Step 3: After registering, a welcome message with further instructions is sent to your email address. In the email, you shall find a confirmation link, click on it and it shall direct you to a password entry page.
Step 4: Enter your password and confirm it and then click login. On the page that follows, you shall view the credentials that you have entered. If you want to edit the credentials, make sure you do the changes and hit save. Otherwise, you are all set.
To be able to use the Daraja API, you need to have an app so that you have the required access keys. Creating an app is a very simple process.
Follow the following steps:
Step 1: Click on the My Apps link on the navbar in the developer portal.
Step 2: On that page, click the Add a new app button.
Step 3: On the page that follows, enter your preferred app name. Check the Lipa na Mpesa Sandbox and then click create app. After that, you are all set.
Step 4: Enter your password and confirm it and then click login. On the page that follows, you shall view the credentials that you have entered. If you want to edit the credentials, make sure you do the changes and hit save. Otherwise, you are all set.
Having set up the developer account and an app, it’s time we set up our application. For this article, we shall implement a REST API with Express.js framework. Our end goal is to implement a working endpoint for Lipa na Mpesa online. To handle communication to and from the Daraja API we shall use Axios.
To follow along effectively, clone the finalized project from here. To test our API, we will use Postman. If you are not experienced in postman, feel free to watch this video.
On the portal’s apps page, click on the newly created app from the previous process. In the keys section, copy the consumer key and the consumer secret and paste them in your .env file respectively as shown:
consumer_key = "your consumer key" consumer_secret = "your consumer secret"
30th Nov 2022
[](ht
23rd Nov 2022
The purpose of every businessperson is to make a profit. A well-running business requires minimization of the cost of production and maximizing profits. To
starting a business in kenya legal requirements, legal requirements for starting a business, business licenses and permits kenya, business permit for foreigners in kenya, business license in kenya, types of business permits in kenya, single business permit kenya8th Nov 2022
KRA PIN NUMBERS FOR ALL COMPANIES IN KENYA MOTOR VEHICLES 3843 ASSOCIATED VEHICLE ASSEMBLERS LIMITED P000619379O 3843 B
Comments (0)
Leave a Comment