DEV Community

Cover image for Integrating Mpesa APIs
Daniel Mutuku
Daniel Mutuku

Posted on

Integrating Mpesa APIs

Integrating Mpesa APIs can be a bit overwhelming at first. Having done it multiple times, I remember feeling lost in the process before finally mastering it. That's why I created this guide to help you get started without the hassle. This article is based on years of experience, Safaricom's official documentation, and valuable insights from their support team when I encountered roadblocks along the way.

Step 1: Apply for a PayBill or Till Number

Before starting the Mpesa API integration, you need to have a PayBill or Till number. If you don't already have one, your first step is to apply. You can do this by:

To successfully register a Till or PayBill number, you'll be required to provide the following:

  • KRA PIN certificate for the company
  • Certificate of company registration
  • Bank account details (Cancelled cheque)
  • KRA PINs of all directors
  • Copies of IDs for all directors
  • Duly filled Mpesa authorization form (Download it Here). In the authorization form, you will be required to provide Company's Seal or Stamp.
  • Duly filled MPesa Service application form (Download it Here)
  • CR12 (valid for 90 days)

If you already have a Till or PayBill number, you can move on to the next step. However, additional documents may be needed, particularly if:

  • The PayBill/Till number was issued by a bank
  • The PayBill/Till number is registered to a business name rather than an incorporated company.

Step 2: Sign Up for G2 Portal

Later, when you're ready to go live with the Mpesa API integration, you'll need to apply for API credentials through the Daraja portal. At this point, you'll be required to provide the usernames of the business manager or administrator used to access the G2 portal.Therefore, it's a requirement to already have signed up for G2 portal before you can request for the API credentials.

To get access to the Mpesa portal (G2), you'll need to send these documents to lipanampesa@safaricom.co.ke 

Within approximately 24 hours, you'll receive an email with instructions on accessing your G2 portal. At this stage, you'll be prompted to set a new password and create a Business Manager account in the G2 portal for managing your API credentials and transactions.

Step 3: Apply for Live API Credentials

Before going live with your Mpesa integration, you can create a Sandbox application in the Daraja portal and use the provided credentials to test your implementation. Once you're ready to go live, replace the demo credentials, environment, and endpoints with the live versions.

To obtain live credentials, log in to your Daraja portal and click "Going Live." Complete the business verification form as prompted.

If you encounter any issues verifying your business and have already completed the previous steps, you can contact apisupport@safaricom.co.ke for assistance. Once your application is approved, the live credentials will be sent to your registered email.

In a nutshell

To streamline the Mpesa API integration process, here's a complete checklist for all the necessary requirements across the three steps. This will help you reduce delays between emails and approvals:

  • KRA PIN certificate for the company
  • Certificate of company registration
  • Bank account details (Cancelled cheque)
  • KRA PINs of all directors
  • Copies of IDs for all directors
  • Duly filled Mpesa authorization form (Download it Here). In the authorization form, you will be required to provide Company's Seal or Stamp.
  • Duly filled MPesa Service application form (Download it Here)
  • CR12 (valid for 90 days)
  • A completed and stamped Mpesa Business Administrator form (Download it here).

Thank you for taking the time to read this article! If you'd like to see more content like this, feel free to follow me. If you need assistance with Mpesa or any other API integrations, don't hesitate to reach out via Email or connect with me on LinkedIn. I'm also building ThulaZone, a collection of free, ad-free tools designed to simplify your day-to-day tasks - things you might usually pay for elsewhere. Be sure to check it out and see what I've created for you.
Keep striving, stay inspired. Until next time - Adios!

Top comments (0)