Skip to main content
+254 754 550 099  |  [email protected] Login Register
Serving customers worldwide — servers in Nairobi, Kenya · Pay securely with Visa, Mastercard, or M-Pesa via PesaPal
M-Pesa Payments

M-Pesa Integration Kenya: Daraja API Guide & Costs (2026)

Administrator 0 views

If you sell anything online in Kenya, customers will ask one question first: "Can I pay with M-Pesa?" Getting a clean "yes" means connecting your website to Safaricom's payment system, and that is exactly what M-Pesa integration Kenya is all about. In this guide we break down how the Daraja API and STK Push actually work, what you need to get started, what it costs, and whether you should build it yourself or hire someone to do it for you.

What M-Pesa Integration Actually Means

M-Pesa integration simply means your website or app can request, receive and confirm M-Pesa payments automatically, without you manually checking your phone for "received KSh" messages. Instead of telling customers to send money to a number and screenshot the confirmation, the payment happens right inside your checkout. The money lands in your Paybill or Till, and your system instantly knows the order is paid.

All of this runs on Safaricom's Daraja API (the Lipa Na M-Pesa developer platform). Think of Daraja as the bridge between your website and Safaricom's servers. Your site sends a payment request through Daraja, Safaricom prompts the customer, and Daraja sends back a "paid" or "failed" message your system can act on.

Daraja API in Plain Language: STK Push, C2B and B2C

The Daraja API offers a few different "products". You will mostly hear about three:

  • STK Push (Lipa Na M-Pesa Online): The most popular one. The customer enters their phone number at checkout, a pop-up appears on their phone asking for their M-Pesa PIN, they approve, and payment is done. No paybill numbers to remember, no account numbers to mistype. This is what most Kenyan businesses want.
  • C2B (Customer to Business): Handles payments where customers pay your Paybill or Till directly, and Safaricom notifies your system. Useful for invoices, recurring bills and offline payments you still want recorded online.
  • B2C (Business to Customer): The reverse direction, where your business sends money out to customers, for example refunds, payouts, salaries or affiliate commissions.

For a typical online shop or service website, STK Push does the heavy lifting, often paired with C2B confirmations for reliability.

What You Need Before You Integrate

You do not need to be a Safaricom insider to get started. The core requirements are straightforward:

  • A registered Safaricom Paybill or Till number. This is the account where your money will be collected. If you do not have one yet, you apply through Safaricom for a business shortcode.
  • A Daraja developer account. You register on Safaricom's developer portal to get your API keys (consumer key and secret) and access to the sandbox for testing before going live.
  • A hosted website with HTTPS (SSL). Daraja sends payment confirmations to a secure callback URL on your site, so you need reliable hosting and a valid SSL certificate. Our shared hosting plans include free SSL by default, from KSh 80/mo.
  • Someone to wire it together. Either a developer who knows the Daraja flow, or a done-for-you service that handles it all.

Safaricom approves go-live access once your integration passes their checks. Timelines vary, so plan a little buffer before a big launch.

The WooCommerce Option for Online Shops

If you run a WordPress and WooCommerce store, integration can be much faster. There are M-Pesa payment plugins that connect your Daraja credentials to your checkout, adding "Pay with M-Pesa" as a payment method. You still need your Paybill or Till and Daraja keys, but you avoid writing custom code. If you are building a store from scratch, see our guide on how to build an online shop in Kenya with WooCommerce, then bolt M-Pesa on top.

M-Pesa Integration Costs in Kenya

The big question: how much does it cost? At Hostiko we offer fixed, one-time integration packages so you know exactly what you are paying. Here is our current pricing for M-Pesa integration in Kenya:

PackagePrice (one-time)Best for
Basic (STK Push)KSh 15,000A single website or shop that needs the M-Pesa pop-up checkout working cleanly.
BusinessKSh 35,000Stores needing STK Push plus C2B confirmations and order reconciliation.
EnterpriseKSh 70,000Custom platforms needing STK Push, C2B and B2C payouts with deeper system integration.

These are one-time setup fees, not monthly subscriptions. Note that Safaricom separately charges transaction fees on the money you collect through your Paybill or Till; those are set by Safaricom and are independent of the integration work.

DIY vs Done-For-You: Which Should You Choose?

You can absolutely integrate M-Pesa yourself if you or your team can code. The Daraja documentation, sandbox and sample flows are all freely available. DIY makes sense when you have in-house developers and want full control.

That said, most business owners we work with choose done-for-you for good reasons. Daraja has a learning curve: callback URLs, security credentials, token expiry, sandbox-to-production switching and edge cases like timeouts and duplicate payments all need handling. A botched integration can mean customers being charged without orders being marked paid, which is a support nightmare. Paying a fixed fee to get it right the first time is often cheaper than weeks of debugging.

Rule of thumb: if M-Pesa is how you get paid, do not treat it as a weekend experiment. Get it working reliably, then focus on selling.

For the wider picture on collecting money online, including cards and other methods, read our guide on how to accept online payments on a Kenyan website. And if you are still choosing a host, our walkthrough on how to host a website in Kenya and pay with M-Pesa covers the foundation.

Frequently Asked Questions

How long does M-Pesa integration take?

The technical work for a standard STK Push setup is usually quick once your Daraja account and Paybill or Till are ready. The variable is Safaricom's go-live approval, which depends on their review. Have your shortcode and developer account sorted early to avoid delays.

Do I need a Paybill or a Till number?

You need at least one Safaricom business shortcode, either a Paybill or a Till (Buy Goods) number, to receive payments. Which one suits you depends on your business type. Both can work with the Daraja API for STK Push.

Can I add M-Pesa to my WooCommerce store without coding?

Largely yes. M-Pesa plugins let you connect your Daraja credentials and enable an M-Pesa checkout option without custom code. You will still need correct API keys and a registered Paybill or Till for it to work in production.

Is the integration fee a monthly cost?

No. Our integration packages (from KSh 15,000) are one-time setup fees. Safaricom's per-transaction charges on collected payments are separate and set by Safaricom.

What happens if a customer pays but the order is not marked paid?

This is exactly what proper integration prevents. A well-built setup uses Daraja's confirmation callbacks and reconciliation so every successful payment is matched to an order automatically. Done-for-you packages are built to handle these edge cases.

Ready to let customers pay you with M-Pesa the moment they decide to buy? Explore our M-Pesa integration packages starting at KSh 15,000, and we will handle the Daraja setup end to end so you can get back to running your business.

Tags: M-Pesa integration Kenya Daraja API STK Push accept M-Pesa online WooCommerce M-Pesa online payments Kenya
Share this post:

Get Your Website Online in Kenya

Web hosting from KSh 200/mo. Free SSL. M-Pesa payment. Instant activation.

Start Hosting Today

Kenya's most affordable hosting. Pay via M-Pesa.

Get Started