MPESA API: How to integrate Mpesa to your Website or Application

Mpesa integration is the syncing of an application, website or system with the Mpesa web API with the goal of automating payment verification and management of payments

M-Pesa has approximately 30 million users in Kenya. This number extends by 20 million when you add users across other parts of Africa, such as Tanzania, the Democratic Republic of Congo (DRC), Mozambique, Lesotho, Ghana and Egypt. 

This reach can work as a gold mine for a business in Africa that wishes to collect and receive payments using Mpesa.

Getting access to Mpesa will be a long strenuous process. There are alternatives to getting started on Mpesa API that is less stressful. We highly recommend using KopoKopo instead. 

For the brave, this article will address how to connect Mpesa to your business processes using HelloDuty.

What is an Mpesa API, and how does its Integration with businesses work?

M-Pesa API is an application programming interface that allows developers to access and integrate the M-Pesa platform with other applications. It allow developers to create applications that can be used to send and receive money, pay bills, and even make purchases. The API also provides businesses access to various other services, such as airtime top-up, balance inquiry, and customer registration.

The M-Pesa API integration enables businesses to receive payments from their customers via M-Pesa pay bill or till number. Businesses can access the M-Pesa API to integrate payments into their websites, mobile apps, and other platforms if they want to be involved. Through the Integration , customers are able to pay for goods and services using their M-Pesa account on a business's platform. 

Through the Integration, businesses can also have access customers' transaction history, reverse payments, and more. All transactions made between businesses and customers into their accounts are secure, and they all comply with the terms and conditions of Mpesa and local banks.

What are the benefits of having an Mpesa integration?

The M-Pesa API integration with businesses allows them to sync payment transactions to their application, website, or system with the Mpesa web API to automate payment verification and management of payments.

With the Mpesa Paypal integration, it is only a matter of time before users can pay directly from Paypal to their Mpesa pay bill. This is not to forget the recently announced Visa/Mastercard integrations. Its Integration with businesses has brought many benefits that every business seeks. Let's find out more of these benefits as stated down below;

  1. Increased customer base

Mpesa has been one of the most significant financial inventions for every business looking to serve its customers. Its expansive user base in Kenya, with over 23 million customers in Kenya alone, has enabled businesses to expand their customer base.

  1. Improved cash flow

The Mpesa integration with businesses has been able to cater to services that involve securing payments and higher transaction limits into users accounts, making it easy for every business's operation. This has led to an improvement in the cash flow observed by businesses.

  1. Reduced transactions costs

With the costly transaction charges that may come with withdrawing a large sum of money from traditional payment accounts, Mpesa has been able to cut transaction costs for customers dealing with the business resulting in lower transaction charges.

  1. Enhanced convenience

The transactions made through the Mpesa account have been secure and convenient to all customers dealing with businesses that have integrated Mpesa into their business systems. Payments can be made anywhere, whether at home or outside the office, regardless of the customer's environment.

  1. Increased sales

With Mpesa API being easy to use and input by customers all over, the application has given businesses a seamless and smooth run that will get customers paying without the fear of being scammed. This has enabled customers to trust the businesses they are dealing with and make more orders leading to more sales.

How to integrate Mpesa into your business processes.

To integrate your business with Mpesa API, here are 4 steps you can follow for it to be successful;

1. Request for a Paybill or a BuyGoods number.

There are multiple ways to request a BuyGoods or Paybill number. The easiest is via the 'Mpesa for business' portal . 

The others include sending an email to [email protected] and dialing *234# from your Safaricom phone number. Then select 'merchant services' followed by 'my request'. 
Before making your application, make sure you have the following documents

  • Company KRA Pin certificate 
  • Copy of CR12 (Validity 90 days)
  • Scanned copy of the certificate of registration
  • Front and back scanned copies of the directors Id's or Passport
  • Mpesa Authorization ( form signed by two directors. 
  • Directors' KRA PIN certificates
  • Bank details.

All the above documents need to be in PDF format. 

If you have any questions about the process, you can find answers in the FAQ.

Once your application has been reviewed and approved, you will receive an email from Safaricom with your new Mpesa Paybill or BuyGoods number. Otherwise, you will receive an email asking for more documents if they need clarification. Note that it might take 24 hours for a response to each communication. To cut on the turnaround time, ensure you provide the correct details.

2. Request for access to the portal.

Mpesa G2 portal

Most developers in Kenya are familiar with Mpesa Daraja , but many might not know of the G2 portal.

To access the Mpesa G2 portal, you must send the following documents to [email protected] in PDF,

  • A scan of your company's CR12 and company registration certificate.
  • A scan of the elected Administrator's ID both front and back.
  • A signed and stamped Administrator Form signed by at least two signatories. 

Indicate this in bold if it's a sole proprietorship or a company with a single director. 

Cross your fingers; in 24 - 48 hours, you should receive an email with your username and password, with instructions on how to log in to the G2 portal. 

Ensure you visit the Mpesa portal to sign in and change your passwords before you proceed. Create both a Business Admin and a Business Manager user and log in to them.

3. Go Live on Daraja

Mpesa daraja portal

Congratulations on getting to this step. You are a moment away from going live and activating your Mpesa tokens. 

Head over to Daraja and click on the 'Go Live' and input the following values:

  • Verification Type: Short Code
  • Organization Short Code : [Your Paybill or BuyGoods]
  • Organization Name: [As submitted in your application]
  • Mpesa Username: [Either the Business Admin or Business Manager]

If you get an error like "Verification failed! Paybill or M-Pesa username keyed in does not exist", write an email to [email protected].

Finally, write an email to [email protected] and ask them to approve your Daraja app. You are now ready to get started. 

4. To code or no code?

That should not be the question. Once your application is approved, you will receive an email from Safaricom with the keys and instructions on how to proceed. Use a platform like Hello Duty to add Mpesa into your business process without requiring code or a developer.

How to integrate M-Pesa to your website

The process of integrating M-Pesa into your website is easy with all the necessary documents at hand. With us are some of these steps simplified and put together for your understanding as follows;

  1. The first step you need to take is to download and sign up for an M-Pesa business account that you will be using.
  2. The next step you need to do is to integrate the M-Pesa payments API into your website so that, through the mobile checkout flow, you will be able to collect payments.
  3. Install and set up webhooks that will automatically notify you once payments are made to your M-Pesa account.
  4. If you want to confirm or check the status of payments made to your account, use the M-Pesa Query API to get the correct information.
  5. Consider integrating the M-Pesa Disbursement API into your account for refunds and other transactions.

Last updated
March 5, 2024
Single Inbox

Are you ready to get started? Sign up here for a demo of the HelloDuty CRM and customer engagement automation software now.

Pesalink - BlackSistema Bio - BlackTatu City - BlackStartimes - Black
Sunculture Logo

It works for our customer SunCulture. We help agents sell solar in rural Kenya. It takes a few hours, not months, to design and build new ideas.

Relationships that matter.

Plan, engage, and analyse with ease. Transform your customer relationship with an all-in-one platform.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.