How to Integrate M-Pesa into Your Business (2026 Guide)
Paybill or Till, which Daraja API does what, three ways to connect M-Pesa to your business, and real examples for shops, landlords, schools and online stores.
To integrate M-Pesa into your business, you need a Paybill or Till number from Safaricom and a way to connect it to your systems. There are three routes. You can write code against Safaricom's Daraja API yourself. You can use a payment gateway that accepts M-Pesa. Or you can use a no-code automation tool that connects your own Daraja keys to the rest of your business. Which one fits depends on what you want M-Pesa to do: take payments, confirm them automatically, or pay people out.
This guide walks through what each M-Pesa API does, the three ways to integrate, what you need before you start, and real examples by type of business.
Step 1: get a Paybill or Till number
Every M-Pesa integration starts with a business number from Safaricom:
- Till number (Buy Goods): best for shops, restaurants and anyone paid for goods or services on the spot. The customer pays the Till with no account number.
- Paybill: best when you need to know who paid for what, such as invoices, rent, school fees or subscriptions. The customer enters an account number, so you can match each payment to a customer or invoice.
Apply through Safaricom's M-Pesa for Business channels. You'll need your business registration documents. If you invoice customers, a Paybill usually saves the most reconciliation time later.
Step 2: decide what M-Pesa should do for you
Safaricom's Daraja platform has a separate API for each job. Knowing which you need saves weeks:
- M-Pesa Express (STK push): send a payment prompt to a customer's phone. They enter their PIN and the money lands in your Paybill or Till. Use it for checkout, invoices and payment reminders.
- C2B (customer to business): get notified whenever anyone pays your Paybill or Till, even if they paid from their own M-Pesa menu. Use it for instant receipts and automatic reconciliation.
- B2C (business to customer): send money from your business to people's phones. Use it for salaries, commissions, refunds and supplier payments. It needs a B2C shortcode and an initiator set up with Safaricom.
- Transaction status: look up any payment by its M-Pesa receipt number.
- Reversal: reverse a payment you received by mistake.
Most small businesses start with two: STK push to collect, and C2B to confirm. Payouts come later.
Step 3: choose how to integrate M-Pesa
Option A: build it yourself on the Daraja API
Create an account on Safaricom's developer portal (developer.safaricom.co.ke), create an app, and write the code: get an access token, build the request password, send requests, and handle the callbacks Safaricom sends to your server. You get full control, but you need a developer and a server with a public HTTPS address, and you have to maintain it. Budget a few weeks for a first integration that handles failures properly.
Option B: a payment gateway that accepts M-Pesa
Some payment gateways and e-commerce plugins accept M-Pesa alongside cards. This is quick for an online checkout, but the money often goes through the gateway's account before reaching you, there are extra fees on top of M-Pesa's, and you usually get only checkout: no payouts and no automatic follow-up in your other tools.
Option C: no-code automation with your own Daraja keys
A no-code tool such as CiraIQ connects your own Daraja app to the rest of your business, so money goes straight to your Paybill or Till. You don't write code, but you can still chain M-Pesa to anything: a Google Sheet, WooCommerce, an SMS receipt, a WhatsApp alert. This is the route for businesses that want M-Pesa to drive their work, not just take a payment.
What you need before you start
- Your Paybill or Till number, and the Store or Head Office number if it's a Till.
- A Daraja account and an app, which give you a consumer key and secret.
- The Lipa na M-Pesa passkey for STK push. You get the live one from Safaricom when you go live.
- For payouts, a B2C shortcode with an initiator name and security credential.
- A test plan: run everything in the Daraja sandbox (test shortcode 174379) before using real money.
M-Pesa integration examples by business
Online shops
Every unpaid order sends an STK push for the exact total. When the customer pays, the order moves to Processing with the M-Pesa receipt attached, and you get a WhatsApp. Template: M-Pesa for WooCommerce: STK Push on Every Order.
Shops and service businesses paid by Till or Paybill
Every payment gets an instant receipt by SMS and a row in your payments log, so month-end reconciliation becomes a filter instead of an afternoon. Template: M-Pesa Receipt by SMS for Every Payment.
Businesses that invoice: landlords, schools, consultants
Every weekday, everyone who owes you gets a reminder with an M-Pesa prompt, and paid invoices mark themselves paid. Template: Invoice Reminder Email with an M-Pesa Payment Prompt.
Businesses that pay people
Pay commissions, casual workers or suppliers every Friday from a list in Airtable, with a limit per payout and per run. Template: M-Pesa Bulk Payment Every Friday from Airtable.
Anyone who gets paid by mistake
When a customer pays the wrong amount or the wrong account, check the payment by its receipt number and reverse it safely. Template: M-Pesa Reversal Check for Wrong Payments.
How to set up M-Pesa in CiraIQ
- Add your M-Pesa credential. Choose sandbox or production and paste your Daraja consumer key, secret, shortcode and passkey. They're stored encrypted.
- Pick what starts the workflow. Use "M-Pesa Payment Received" to start when anyone pays your Paybill or Till. Or start from something else, like a new order, a row in a sheet, a message or a schedule.
- Add the M-Pesa steps you need. Use M-Pesa to send a payment prompt, M-Pesa Payout to send money, and M-Pesa Transaction to check or reverse a payment.
- Connect the rest. Mark the invoice paid, send the receipt, tell your team on WhatsApp or Telegram.
- Test, then switch to live keys. Payouts and reversals have limits and start as dry runs, so no money moves until you switch them on.
See everything M-Pesa can connect to on the M-Pesa integration page, and how other Kenyan businesses use CiraIQ on the CiraIQ in Kenya page. If you're adding STK push, read M-Pesa STK push integration without writing code first.
Questions
How do I integrate M-Pesa into my website?
Get a Paybill or Till, create a Daraja app, and connect it to your site, either with your own code, a payment plugin, or a no-code tool that sends an STK push when an order is placed and marks it paid when the money arrives.
Is the M-Pesa Daraja API free?
Signing up for Daraja and creating apps is free. The normal M-Pesa charges for your Paybill or Till still apply to each payment.
Can I integrate M-Pesa without a developer?
Yes. You still create a Daraja app and copy your keys, which takes about an hour. A no-code tool handles the rest: the requests, the callbacks and the status checks.
Paybill or Till: which is better for integration?
Both work with STK push and payment notifications. Choose a Paybill if you need to match payments to invoices or customers through the account number, and a Till for simple point-of-sale payments.
Can M-Pesa send payments automatically?
Yes, through the B2C API. It needs a B2C shortcode and an initiator set up with Safaricom. Always use limits per payment and per run.
How long does it take to integrate M-Pesa?
Getting the Paybill or Till depends on Safaricom's approval. Once you have it, a no-code setup takes an afternoon. A custom integration built from scratch usually takes a developer a few weeks to do properly.
Automate something like this in an afternoon.
Browse ready-made automations