Cortex AutoBill
CortexAutoBill
Billing & Payments· 8 min read

How to Automate M-Pesa Billing for Your Kenyan ISP (2026 Guide)

Step-by-step guide to setting up fully automated M-Pesa STK Push and C2B paybill billing for a Kenyan ISP. Learn how to eliminate manual payment follow-ups, reduce churn, and reconcile M-Pesa payments automatically.

If you are running an ISP in Kenya, M-Pesa is not optional — it is the primary way your subscribers pay. Yet most ISP billing platforms treat M-Pesa as an afterthought: a webhook to a third-party service, a plugin that breaks when Safaricom updates the Daraja API, or worse, a manual process where your accounts team checks M-Pesa messages and updates subscriber balances by hand.

Why manual M-Pesa reconciliation is costing you money

Consider a mid-sized ISP with 300 subscribers. If 40 % pay within 3 days of the billing date, your team is processing 120 manual M-Pesa notifications per billing cycle. Each lookup and update takes 3–5 minutes. That is 6–10 hours of billable staff time — every month — on a task that should be zero.

Manual reconciliation also introduces a delay between payment and reactivation. A subscriber who paid at 7 PM may still be suspended at 9 PM when your office is closed. They call support, you lose goodwill, and you spend the morning clearing a backlog.

M-Pesa integration methods for ISPs

1. Customer-to-Business (C2B) Paybill

C2B lets subscribers send money to your Safaricom Paybill number with their account number as the reference. Safaricom sends a real-time confirmation to a callback URL you register in the Daraja portal. Your billing system receives this callback, matches the account number to a subscriber, and credits the balance immediately.

  • No action required from the subscriber beyond the standard M-Pesa send menu
  • Works even when your app is offline — Safaricom queues callbacks
  • Idempotency required: the same TransactionID must never be applied twice

2. STK Push (Lipa Na M-Pesa Online)

STK Push initiates a payment request directly on the subscriber's phone. Your billing system calls the Daraja STK Push API, Safaricom sends a prompt to the subscriber's handset, and they authorise the payment with their M-Pesa PIN. The callback arrives within seconds.

  • Best UX — subscriber pays without leaving a prompt
  • Ideal for auto-renewal: trigger at midnight on billing day
  • Requires an active Safaricom Paybill or Till Number with API access

What a fully automated M-Pesa billing flow looks like

  1. Billing engine runs at midnight on the subscriber's renewal date
  2. STK Push is dispatched to the subscriber's registered phone number
  3. Subscriber authorises payment from the M-Pesa prompt on their phone
  4. Daraja callback arrives at the billing system within 10–30 seconds
  5. Payment is matched to the subscriber, balance is credited, router access remains active
  6. Africa's Talking SMS sends a confirmation: 'Your Acme ISP subscription has been renewed. Thank you.'
  7. If STK Push times out (subscriber misses it), billing system waits for a C2B payment and resumes on receipt

Handling failed and stuck payments

Daraja callbacks sometimes fail in transit. The subscriber's phone confirms payment but no callback arrives. A good billing system must poll the Daraja Query API after a timeout to check the final status, and must be able to apply the payment retroactively if it arrives late.

Cortex AutoBill includes a stuck-payment auto-correction engine. If a Daraja callback is delayed or lost, the system queries the Daraja transaction status API and reconciles automatically — no manual intervention required.

Checklist: 5 things your M-Pesa ISP billing setup must do

  • Idempotent callback processing — the same TransactionID must never credit twice
  • Automatic STK Push on billing day, with C2B fallback
  • Real-time subscriber reactivation within 60 seconds of confirmed payment
  • Stuck payment detection and auto-resolution
  • SMS confirmation to subscriber on every successful payment

Cortex AutoBill handles every item on this checklist out of the box.

See it live — request a free demo