Image of BURST DARK LOGO on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
Get a Free Quote

M-PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide]

Image of preload on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
Written by: BURST DIGITAL

In Kenya, M-Pesa has revolutionized the way businesses and consumers handle financial transactions. It's not just a payment method; it's a financial powerhouse that has redefined convenience. If you're considering accepting payments via M-Pesa on your website, you're about to open up a world of opportunities. This guide will walk you through the process step by step, from the requirements to going live and accepting payments right away.

Do you need help with M-Pesa integration for your website or app? Burst Digital can help! Contact us on WhatsApp at +254 708 865 088 to request our demo or test it yourself on our website checkout using this product. We charge 5,000 KES for the process. For WordPress, check out our M-Pesa Push Toolkit PRO with callback processing here. If you’re using a custom website, check out our step-by-step guide on integrating M-Pesa using PHP into your website.

What Is Lipa Na M-Pesa?

Before we dive into the nitty-gritty of integration, let's take a moment to grasp the significance of Lipa na M-Pesa. Translating to "Pay with M-Pesa," this mobile payment service by Safaricom has taken Kenya by storm. It's not just a payment method; it's a way of life for many. With the power to transform your online business, accepting Lipa na M-Pesa payments is a game-changer not just in Kenya but globally.

What is an M-Pesa API, and How Does Its Integration with Businesses Work?

An M-Pesa API, or Application Programming Interface, serves as a bridge that connects the M-Pesa platform with various applications. This integration empowers developers to create solutions for sending and receiving money, paying bills, and making purchases. Additionally, businesses can tap into the M-Pesa API to offer services like airtime top-up, balance inquiries, and customer registration.

M-Pesa API integration is the process that allows businesses to accept payments from their customers through M-Pesa pay bills or till numbers. This integration seamlessly embeds payment options within websites, mobile apps, and other digital platforms. Customers, in turn, can conveniently use their M-Pesa accounts to pay for products and services on these platforms.

Furthermore, this integration equips businesses with the ability to access valuable insights, including transaction histories and the flexibility to reverse payments when necessary. It's essential to note that all transactions conducted between businesses and customers are secure and comply with the terms and conditions set by M-Pesa and local financial institutions. This seamless integration streamlines financial interactions, enhancing the overall customer experience.

What Are the Benefits of Having an M-Pesa Integration?

M-Pesa integration with businesses brings a host of benefits, streamlining financial transactions and enhancing user experiences. Here's a closer look at the advantages that make it a game-changer for businesses in Kenya:

  1. Expanded Customer Base - M-Pesa boasts a substantial user base in Kenya, with over 23 million customers. For businesses, this means access to a broader audience and the opportunity to grow their customer base significantly.
  2. Improved Cash Flow - M-Pesa integration enables secure payment management and offers higher transaction limits, contributing to improved cash flow for businesses. This streamlined approach simplifies financial operations.
  3. Reduced Transaction Costs - In contrast to traditional payment methods, M-Pesa minimizes transaction costs, resulting in lower charges for customers. This cost-efficiency is a win-win for both businesses and their clientele.
  4. Enhanced Convenience - M-Pesa transactions are known for their security and convenience. Whether customers are at home, in the office, or on the go, they can make payments without concerns about their surroundings. The seamless nature of these transactions benefits businesses and customers alike.
  5. Increased Sales - The user-friendly M-Pesa API facilitates quick and trustworthy transactions. Customers have confidence in businesses that have integrated M-Pesa into their systems, leading to increased orders and, ultimately, higher sales.
  6. Streamlined Payment Management - M-Pesa integration enables businesses to sync payment transactions to their applications, websites, or systems, automating payment verification and management. This simplifies financial operations and enhances efficiency.
  7. Potential for Global Payments- M-Pesa's integration with PayPal and the recent Visa/Mastercard announcements opens up the possibility of global payments, adding an extra layer of convenience for businesses and their customers.

Embracing M-Pesa integration is not just about keeping up with trends; it's about optimizing your business's financial operations and enhancing the customer experience. By offering secure, efficient, and cost-effective payment options, businesses can unlock their full potential and achieve sustained growth.

How to Integrate M-Pesa Into Your Business Website Processes

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

Step 1: Ensure You Have a Paybill or Buygoods Number (Skip if You Have One)

Before proceeding with the integration process, make sure you already possess a Paybill or BuyGoods number. If you already have one, you can skip this step.

Image of safaricom lipa na m pesa on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
How to Get Safaricom Lipa Na M-pesa Till Number
  • Begin by requesting a Paybill or BuyGoods number, which can be easily done through the 'M-Pesa for Business' portal. Alternatively, you can send an email to Mpesabusiness@safaricom.co.ke or dial *234# from your Safaricom phone. Follow these steps to make your application:
  • Ensure you have the required documents in PDF format, including your company's KRA Pin certificate, a copy of company CR12 (validity 90 days), a scanned certificate of registration, front and back scanned copies of directors' IDs or passports, M-Pesa Authorization form (download it here) signed by two directors, directors' KRA PIN certificates, and bank details.
  • Once your application is reviewed and approved, Safaricom will email you the new M-Pesa Paybill or BuyGoods number. If further clarification is needed, you will receive an email requesting additional documents. The entire process typically takes around 24 hours.

Step 2: Create an account on M-Pesa G2 Portal

  • Gather the Required Documents: Ensure you have the following documents ready:
    • A scanned copy of your company's CR12 OR company registration certificate.
    • A scanned copy of the elected Administrator's ID (both front and back).
  • Administrator Form Filling: Proceed with the following steps for filling out the Business Administrator Form:
    • Download and fill the M-Pesa Business Administrator Form with your company's information.
    • Ensure the provided information matches the details on the CR12 and registration certificate.
    • Let all directors sign it, (in case of Sole Proprietorship, the single director will sign it), stamp it
  • Email Submission: To initiate the account creation process from Safaricom, send the following email to M-PESABusiness@safaricom.co.ke with your documents attached, subject "Request for Mpesa Portal Login" and include the following message: " Hello, kindly activate my administrator account for M-Pesa G2 Portal. Attached is the duly filled and stamped Business Administrator form, company registration certificate(s), and copies of IDs. Regards."
  • Receive Login Credentials: Once you've submitted the necessary documents and request, Safaricom will process your application within 24-48 hours. You will receive an email from them containing your username and password for the M-Pesa Portal.
Image of M Pesa G2 Portal Creating an account process 1024x421 on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
Login screen for Safaricom’s G2 Platform.
  • We'll need to create two users: " API Operator" and " Web Operator" with certain roles. Note that this is crucial step or else the plugin will not work and you will get an error as shown:
Image of M Pesa express is unreacheable error resolved on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
M-Pesa express is unreacheable error

**************************************************************************

  • Proceed to log in, and click on Browse Organization
  • Next, click on Operators, then click on the Add icon
Image of 0*wb09WVQDfNGLKQ8Q on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin

Creating an API Operator

  • Start by creating an API operator. Select API under Access Channel
Image of 0*EThKr0pQ72fIZL2D on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
  • Enter an appropriate API username and click on Next
Image of 0*iCe86s7zVguyM LS on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
  • Under Rule Profile, select Web Operator Rule Profile
Image of 0*islKRYnLhRYCHigf on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
  • Then click on the *Add* icon, and select the following options under the Select Role dialog, then click on OK
Image of 0*7eS9OmlzU4lVTelw on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
  • After that, you’ll see screen of the roles you just select, you can add more roles here or just hit the Next button
Image of 0*an 8mMGzLameDBJx on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
  • The next option is the *Know Your Customer — KYC* fields, enter the details and click on next. Make sure under Preferred Notification Channel, you select SMS and your phone number follows the format 2547xxyyyyyy e.g 254746490042. After that click on next and finish
Image of 0*1zKcOvfUiwAPyYvB on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin

Creating a Web Operator

  • Click on Operators then on the Add icon
Image of 0*A2 ZFFPjx1hB AsF on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
  • Then select Web under Access Channel
Image of 0*8ncShKTGa4AHDLXg on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
  • Enter an appropriate username and note it down as you will need it to login back to the MPESA portal later
Image of 0*28lJm ZSebeIf11G on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
  • Under Rule Profile, Select Web Operator Rule Profile
Image of 0*1rBBR2wIDVQqeTHX on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
  • Then click on Add button and select the options shown below under Role
Image of 0*fD08PbVzOVitQQWQ on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
  • Then hit next after that
Image of 0*dSvhC2w0wyMdMJ7o on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
  • Fill in the KYC details as shown below
Image of 0*TpMEqxSnnrXTZFV7 on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
  • Finally submit to create your Web Operator. Immediately you submit, you will receive a SMS on the number you entered under KYC information. The SMS contains the username and password for your Web Operator. Logout and log back in using the details on sent the SMS to activate the Web Operator. In order for the plugin to work, the web operator must be active
Image of 0*63iZgEuw3HnY0hhe on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin

Step 3: Going Live on Daraja Portal

Daraja is a powerful portal that plays a significant role in M-Pesa API integration. Here's what it does and what you need to do:

  • Daraja Portal: The Daraja portal is essential for managing M-Pesa transactions. It allows you to access and test various M-Pesa APIs before going live.
  • Create a Developer Account: To utilize Daraja's capabilities, you need to create a developer account on the Daraja portal. This account will enable you to test the APIs and ensure everything runs smoothly before launching your integration.
  1. Access the Developer Portal: Go to the daraja developer portal and click "Go live."
  2. Verification and Setup:
Image of Daraja portal Go Live Mpesa Integration 1024x270 on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
Go Live Safaricom Developer Portal Screen
  1. You will need to verify that you are the legitimate owner of the API before proceeding to go live.
  2. The verification process includes filling in the following company details:
    • Verification Type: Select "Short Code."
    • Organization Short Code: (Paybill Number / Store Number if it’s a till)
    • Organization Name: (Use the exact name that shows up on the Safaricom G2 Platform)
    • M-Pesa Username: (Web Operator User we just created)
    • Accept the terms and click 'next step'.
    • You will then receive an OTP sent to the number you registered in Step 1 and asked to select a product. You might as well check everything available. Click 'submit'.
  3. Create a sandbox app: Once that is done, you can now create an app in sandbox mode (An app provides the credentials necessary: Consumer Key, Consumer Secret and a passkey which will be emailed later separately to you after it's live). It may take some time for it to be approved 24-48 hours again. Once approved, it automatically turns to green showing it is a live app. To view, click on the highlighted dropdown.
  4. Switch to the Live App: You’ll now view the app details as shown below:
Image of M Pesa Api integration Approved production daraja app example 1024x649 on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
M-Pesa Api Integration - Approved Production Daraja App Example

Congratulations!!! You now have the consumer key and consumer secret, however we still need the passkey. Fortunately, the pass key will be emailed to you a little later after the app is activated. Be sure to check all folders including spam to find it. Should you encounter any issues, reach out to apisupport@safaricom.co.ke. Once your Daraja app is approved, you're all set to get started.

Please take note:

Safaricom recently updated their Daraja from version 1 to version 2. There's a peculiar issue that arises if you obtained your Paybill prior to the launch of this V2 platform, especially if you received the pass key a bit earlier. Some V2 APIs might not function properly in such cases! You'll need to adjust the URL to include 'v1' instead. If you're unsure about when the customer's Paybill was created, be prepared for both scenarios.

First, try this URL: https://api.safaricom.co.ke/mpesa/c2b/v1/registerurl

If it doesn't work, switch to the V2 version: https://api.safaricom.co.ke/mpesa/c2b/v2/registerurl

Hopefully this helps a couple of those devs out there who have been emailing me and don’t know why some of their Paybills are not working. Following these steps from start to finish will enable you to successfully integrate M-Pesa into your website, troubleshoot any encountered issues, and ensure smooth operation.

Step 4: Coding or No Coding?

Now that you have all your keys, the question of coding should not be a concern. After your application is approved, Safaricom will provide you with the passkey and instructions via email. We'll delve deeper into custom coding with other programming languages in an upcoming post, for now we will discuss options for using the keys with our WordPress approved plugin on PHP.

So, if you're running your business through a WordPress website and you want to accept payments through M-Pesa, we have a solution just for you - the Mpesa Push Toolkit for WordPress WooCommerce (PRO Version). It's a user-friendly plugin designed by our agency to streamline the integration process. Here's how you can integrate M-Pesa with your WordPress site using the plugin:

  1. Install the M-Pesa Push Toolkit for WordPress: First, you need to install our plugin on your WordPress website. You can download it directly from our plugin repository. Once installed, activate it.
  2. Configure the Plugin: After activation, go to your WordPress dashboard and navigate to the plugin settings. You'll find a user-friendly interface that lets you input the necessary details:
    • Identifier Type: This pro version has the ability to enable you make payments to Till and Paybill numbers by specifying the Identifier Type.
    • Live App's Secret Code: Copy and paste the live app's secret code that you obtained in the previous step.
    • Consumer Key: Enter your Consumer Key here.
    • Pass Key: Enter the pass key sent to your daraja email by Safaricom.
    • Company Name: Fill in your company's name or business name.
  3. Save Your Settings: Save the settings, and you're all set! The plugin will work seamlessly, allowing you to accept payments from customers via M-Pesa. When someone tries to make a payment on your website, our plugin will send a push notification to the respective phone number, ensuring a smooth and secure transaction.
Image of PluginSettings on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
WooCommerce M-Pesa Push Toolkit PRO Plugin Settings page
Image of Mpesa Push Toolkit for WordPress on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
Mpesa Push Toolkit for WordPress
Image of MPESA STK Push plugin mobile on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
Mpesa Push on Mobile - Wordpress Mpesa Integration

Why Choose M-Pesa Push Toolkit For WooCommerce PRO Version

When comparing the free WordPress plugin for M-Pesa payments, found here: https://wordpress.org/plugins/woo-m-pesa-payment-gateway, to its pro version, here are some noteworthy differences:

  • The free version lacks a few key features. It doesn't handle callbacks or support payments to Till numbers. However, upgrading to the pro version unlocks a whole new level of functionality.
  • With the pro version, you can enable payments to both Till and Paybill numbers by specifying the Identifier Type. Plus, it takes care of callback processing, ensuring that your customers stay updated on their transaction status.
  • But that's not all! The pro version goes the extra mile by automatically updating the order status after a successful M-Pesa payment. You even get to choose the specific status you want the order to move to.
  • Just remember, the pro version is limited to one website or domain, so choose wisely during the payment process.

So whether you're running an online store, a booking system, or any other business through WordPress, you can seamlessly integrate M-Pesa payments with our plugin. Get started with the M-Pesa Push Toolkit for WordPress and offer your customers a convenient payment option. We also provide this service as part of our e-commerce package or separately at a flat fee of KES 5,000 or as support if you purchased our pro plugin valued at $50. Our developers will handle everything for you if you find it challenging—all you need is a Paybill or Till number. Call us on 0708 065 088 or email us hello@burstdigital.co.ke now to get started. You can also whatsapp us quickly here.

Stay tuned for our next post, where we'll explore more customized approaches to M-Pesa integration using other languages and frameworks.

Share on Faceboook
Share via WhatsApp
Print/ Save as pdf

How useful was this post?

Click on a star to rate it!

Average rating 4.6 / 5. Vote count: 7

No votes so far! Be the first to rate this post.

Tags :
4.6
(7)

Related Posts

Recommended Products

LIMITED sale on OUR web building tools
0
days
0
hours
0
minutes
0
seconds
Image of animated icons facebook on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
Image of icon Visit us en US on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
Image of animated icons instagram on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
Image of animated icons whatsapp on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin
Image of animated icons tiktok on M PESA API Integration: How to integrate Mpesa Into your Website or Application [2024 New Guide] by Burst Digital tagged WordPress payment gateway WordPress Mpesa integration Secure Mpesa transactions Mpesa payment plugin