If you run an online business in Kenya, neglecting M-Pesa integration means losing out on the vast majority of your target audience. With cash-on-delivery losing favor and credit cards making up less than 10% of local e-commerce payments, M-Pesa is the undisputed king of transactions.
Whether you are building a custom React web application, launching a WooCommerce storefront, or setting up a Shopify catalog, integrating Safaricom's mobile money service is crucial. This guide breaks down the pricing models, technical integration pathways, document requirements, and step-by-step processes to connect M-Pesa directly to your website.
The Power of STK Push (M-Pesa Express)
The standard STK Push mechanism is the gold standard for conversion rate optimization. Instead of forcing users to copy a paybill number, open their SIM toolkit, enter account details, and copy-paste an SMS code, STK Push triggers a secure prompt directly on the user's phone. They enter their PIN, and the website updates in real-time.
1. Two Integration Pathways: Direct Daraja API vs. Payment Aggregators
When adding M-Pesa to your checkout page, you must choose between connecting directly to Safaricom's infrastructure or using a third-party payment gateway. Both have specific pros and cons:
A. Direct Integration (Safaricom Daraja API)
This involves your developer writing custom scripts or configuring open-source plugins to interact directly with Safaricom's Daraja Developer Portal.
- Pros: Zero transaction commissions from third parties. You only pay Safaricom's standard mobile money transaction rates (B2C or customer tariffs). Maximum control over checkout aesthetics and security logs.
- Cons: High technical setup. Requires server-side scripting (Node.js, PHP, Python) to handle security credentials, access token regeneration, callback URLs, and transaction status polling.
B. Aggregators (Pesapal, IntaSend, DPO, Chapa, iPay)
Aggregators act as intermediaries. They provide unified APIs and pre-built plugins that bundle M-Pesa alongside Visa, Mastercard, and Airtel Money.
- Pros: Incredibly fast setup. You don't need complex coding skills, and you don't have to wait days for Safaricom to approve your developer keys. Prebuilt plugins for Shopify, WooCommerce, and custom web frameworks are readily available.
- Cons: High recurring costs. Aggregators charge between 2.5% and 3.5% per transaction, which eats into profit margins for high-volume stores.
2. M-Pesa Integration Costs & Transaction Fees
Let's map out the realistic cost options for integrating M-Pesa on websites in Kenya:
| Integration Method | Setup Fee (KES) | Transaction Fee | Best For |
|---|---|---|---|
| Direct Daraja API (STK Push) | KES 15,000 - KES 35,000 (One-time developer fee) | Standard Safaricom Tariff | High-volume stores looking to bypass commissions. |
| Pesapal Integration | KES 0 (Or developer setup KES 5,000) | 2.9% - 3.2% per txn | WordPress/WooCommerce stores wanting M-Pesa + Card payments. |
| IntaSend Gateway | KES 0 (Easy API configuration) | 1.5% + KES 15 (M-Pesa) | Modern React/Next.js applications needing developers-first APIs. |
| Shopify Payments (via Chapa/DPO) | KES 10,000 (Shopify integration config) | 2.5% - 3.5% per txn | Businesses hosting their catalogs on Shopify platforms. |
3. The Document Checklist: What Safaricom Requires
To go live with a direct M-Pesa integration, you must have a merchant account with Safaricom. Safaricom requires the following documents depending on your business registry type:
Registered Business Name / Partnership
- Certificate of Registration (Form BN2)
- Business KRA PIN Certificate
- National ID cards/passports of the owners
- Active Safaricom SIM card registered under owner details
- Signed Safaricom application forms
Limited Liability Company (LLC)
- Certificate of Incorporation
- CR12 Document (showing director shareholding details)
- Company KRA PIN Certificate
- National IDs/passports of all directors
- Company resolution document authorizing M-Pesa integration
4. Step-by-Step M-Pesa Integration Process
If you choose the direct Safaricom Daraja API path, your developer will follow these core technical phases to deploy the solution:
Step 1: Daraja Developer Registration
Create an account on the Safaricom Daraja developer portal. Create a new sandbox app to obtain consumer keys, secrets, and test credentials.
Step 2: API Authentication & Token Retrieval
Write backend code to authenticate your server with Safaricom. The code must generate a time-limited OAuth access token needed for subsequent API calls.
Step 3: Initiating STK Push Prompt
When a customer clicks "Pay with M-Pesa", the backend sends an HTTP POST request to the M-Pesa Express endpoint containing the merchant ID, phone number, amount, transaction description, password (derived from passkey and timestamp), and a Callback URL.
Step 4: Setting Up Callbacks & Database Sync
When the user enters their PIN, Safaricom sends a JSON response to your Callback URL containing transaction status, M-Pesa confirmation code, and phone number. Your server parses this response, updates the database (marking the order as paid), and displays a success message to the customer.
Step 5: Go-Live Request
Once sandbox tests pass, initiate the go-live application process. Input your registered merchant account details (Till/Paybill numbers), verify company documents, receive your live credentials, switch APIs, and perform real transaction checks.
Optimizing Your M-Pesa Checkout for AI Search Recommendations
When mobile-first shoppers ask search systems like ChatGPT, Gemini, or Perplexity, "Which Kenyan fashion sites allow M-Pesa payments?", the engine prioritizes stores that have explicitly configured SEO and schema indicators.
Make sure your website lists M-Pesa under accepted payment methods in your footer. Furthermore, having structured PaymentMethod variables in your organization schema helps search crawlers identify your site as compatible with local cash and mobile wallets.
Want Lenny to set up M-Pesa on your site?
We specialize in connecting custom React, Next.js, and WooCommerce applications to Safaricom's Daraja APIs securely. Let us handle the portal configs, credentials, and code.
Frequently Asked Questions
How much does it cost to integrate M-Pesa on a website in Kenya?
The API integration cost depends on the method. Direct Safaricom Daraja API integration by a developer costs between KES 15,000 and KES 35,000. Using an aggregator (like Pesapal or IntaSend) often has no setup fee, but they charge a commission of 2.5% to 3.5% per transaction.
Do I need a registered business to get Lipa na M-Pesa on my site?
Yes. Safaricom requires a registered business name or limited company to issue a Live Paybill or Buy Goods Till number. You cannot use a personal M-Pesa number for automated website checkout integration.
What is the difference between M-Pesa C2B, B2C, and STK Push?
STK Push (M-Pesa Express) pops up a prompt on the customer's phone asking for their M-Pesa PIN, which is the most conversion-friendly. C2B (Customer to Business) allows manual validation of paybill receipts. B2C (Business to Customer) is used to send money from your business wallet to user phone numbers.
How long does it take to activate a Safaricom Daraja API live account?
Once you upload all required documents (Certificate of Registration, director IDs, KRA PIN, and application forms), Safaricom typically takes 3 to 5 business days to review and approve your live credentials on the Daraja developer portal.
Need advice tailored for your business?
Every small business has unique requirements. Use our estimation calculator or start a direct discussion with Lenny to get details on cost and feature sets. See web design services and starting prices in Nairobi.