V
Vendly
Back to Blog
M-PesaKENYA
M-Pesa12 min read14 January 2025

How to Accept M-Pesa Payments for Your Business: Complete Integration Guide

Learn how to accept M-Pesa payments for your business using Paybill, Till Number, STK Push, and API integrations. A complete guide for Kenyan SMEs.

Why M-Pesa Is Essential for Kenyan Businesses

M-Pesa processes over KES 35 trillion in transactions annually, making it the backbone of Kenya's digital economy. For any business operating in Kenya, accepting M-Pesa payments is not optional -- it is a fundamental requirement for reaching your customers where they already transact.

Whether you run a retail shop, an online store, or a service-based business, understanding the different M-Pesa payment channels available to you is the first step toward capturing more revenue. This guide walks you through every option, from basic Paybill setups to full API integrations.

Paybill vs Till Number: Which One Should You Choose?

The two most common ways to accept M-Pesa payments are through a Paybill number and a Till number (Buy Goods). Each serves a different purpose and comes with distinct advantages depending on your business model.

FeaturePaybillTill Number (Buy Goods)
Account NumberYes -- customer enters oneNo account number needed
SettlementFunds go to business M-Pesa accountFunds go directly to M-Pesa wallet
Best ForInvoicing, utilities, recurring paymentsRetail, POS, walk-in customers
Transaction FeesTiered based on amountGenerally lower fees
ReconciliationEasier with account numbersHarder without unique identifiers
API IntegrationFull Daraja API supportFull Daraja API support

Paybill numbers are ideal for businesses that need to match payments to specific invoices or customer accounts. The account number field gives you a built-in reference that simplifies reconciliation. Till numbers work best for point-of-sale environments where speed matters more than tracking individual transactions.

Understanding C2B (Customer to Business) Payments

C2B is the most common M-Pesa transaction type for businesses. It covers any payment initiated by a customer to your business, whether through Paybill or Buy Goods. When a customer sends money to your Paybill or Till number, Safaricom can notify your system in real time through a callback URL.

To receive these real-time notifications, you need to register your validation and confirmation URLs with Safaricom through the Daraja API. The validation URL lets you accept or reject a transaction before it completes, while the confirmation URL notifies you after a successful payment.

Always register both validation and confirmation URLs. The validation URL lets you reject payments with incorrect account numbers before the customer's money is deducted, preventing reconciliation headaches later.

STK Push: Requesting Payments Directly

STK Push (also known as Lipa Na M-Pesa Online) flips the payment flow by letting your business initiate the transaction. Instead of asking the customer to navigate to M-Pesa and type in your Paybill number, you send a payment prompt directly to their phone. The customer simply enters their PIN to confirm.

This approach dramatically reduces payment errors because your system pre-fills the business number, amount, and account reference. It also speeds up checkout in e-commerce scenarios where customers would otherwise need to switch between your website and their phone's M-Pesa menu.

Integration Options: No-Code to Full API

Not every business needs a custom API integration. Safaricom and third-party providers offer a range of options depending on your technical capacity and transaction volume.

  1. 1Basic Paybill/Till: Apply through Safaricom directly. No coding required. Suitable for small businesses with low transaction volumes.
  2. 2Payment Links: Use platforms like Vendly to generate shareable M-Pesa payment links. No website needed.
  3. 3Payment Plugins: Pre-built integrations for WooCommerce, Shopify, and other platforms. Minimal setup required.
  4. 4Daraja API: Safaricom's official API for custom integrations. Requires developer resources but offers full control.
  5. 5Payment Aggregators: Third-party services that handle the M-Pesa integration for you, often with additional features like multi-currency support.

Setting Up Your Safaricom Business Account

Before you can accept M-Pesa payments, you need a Safaricom business account. The application process requires your business registration certificate, KRA PIN certificate, and identification documents for the directors. Processing typically takes 5-10 business days.

Once approved, you will receive your Paybill or Till number along with access credentials for the Safaricom Business portal. From the portal, you can view transactions, download statements, and manage your account settings. Keep your portal credentials secure and enable two-factor authentication if available.

Getting Started with the Daraja API

Safaricom's Daraja API is the gateway to programmatic M-Pesa integration. Start by creating an account on the Safaricom Developer Portal and generating API credentials for the sandbox environment. The sandbox lets you test all payment flows with simulated transactions before going live.

The API uses OAuth 2.0 for authentication. You will need to generate an access token using your consumer key and consumer secret before making any API calls. Tokens expire after one hour, so your application should handle token refresh automatically.

  • Register on the Safaricom Developer Portal at developer.safaricom.co.ke
  • Create a new app and note your consumer key and secret
  • Test in sandbox mode with the provided test credentials
  • Apply for production (Go Live) once testing is complete
  • Set up SSL-secured callback URLs on your server

Transaction Fees and Cost Considerations

M-Pesa transaction fees are tiered based on the amount being transferred. For Paybill transactions, the customer typically bears the cost of sending money, while your business may incur withdrawal fees when moving funds from your business account to a bank account. Till number transactions generally have lower fees for both parties.

When comparing costs, factor in the total cost of ownership: Safaricom fees, any third-party integration fees, and the internal cost of reconciliation. A slightly higher per-transaction fee through an aggregator might save you money overall if it eliminates manual reconciliation work.

Best Practices for M-Pesa Payment Acceptance

  • Display your Paybill or Till number prominently at your point of sale and on invoices
  • Use clear, consistent account number formats to simplify reconciliation
  • Implement real-time payment confirmation to improve customer experience
  • Reconcile M-Pesa transactions daily to catch discrepancies early
  • Keep detailed records for tax compliance and KRA reporting
  • Train your staff on how to verify M-Pesa payments and handle common issues

Automate Your M-Pesa Payment Processing

Manual M-Pesa management becomes unsustainable as your business grows. Tracking payments in spreadsheets, manually matching transactions to invoices, and generating reports by hand wastes hours every week. Modern business tools can automate the entire flow from payment receipt to invoice reconciliation to financial reporting.

Vendly connects directly to your M-Pesa business account and automatically matches incoming payments to outstanding invoices. Payment confirmations are sent instantly, your books stay up to date, and you get real-time visibility into your cash flow without lifting a finger.

accept M-Pesa paymentsM-Pesa for businessPaybill vs Till NumberM-Pesa C2BSTK Push integrationM-Pesa APIKenyan business paymentsSafaricom business