M-Pesa & African Stack

Every app built for the Kenyan market eventually needs to accept money. And in Kenya, that means M-Pesa. But most coding courses skip this entirely, or mention it in a single afternoon session that leaves you with more questions than answers.

This hub is a complete developer guide to the African Stack: M-Pesa Daraja API, USSD applications, and WhatsApp Business API. These are the payment and communication rails that serve over 50 million Kenyans daily, and knowing how to build on them is one of the most valuable skills a Kenyan developer can have.

  • Step-by-step Daraja API tutorials from sandbox to production
  • STK Push implementation with proper callback handling
  • B2C payouts and transaction reconciliation
  • USSD app development from scratch
  • WhatsApp Business API integration for developers
  • Testing strategies that do not burn real money

These guides assume you know basic JavaScript or Python and can set up a simple web server. If you do not have that foundation yet, start with our getting started guides and come back here when you are ready to build something real for the Kenyan market.

At McTaba Labs, M-Pesa integration is not an elective. It is core curriculum. Our developers ship payment-enabled projects before they graduate, because that is what the market demands.

Articles in this topic

M-Pesa Daraja API Tutorial for Absolute Beginners

A step-by-step tutorial for developers who have never touched the Daraja API. Covers what Daraja is, registering on the Safaricom developer portal, getting your credentials, and making your first successful API call.

guide

STK Push Explained: How Lipa Na M-Pesa Actually Works

A complete explanation of how STK Push (Lipa Na M-Pesa Online) works under the hood. The full lifecycle from initiation to callback, what users see on their phone, and the developer pitfalls that trip up most implementations.

guide

Getting Your Daraja Sandbox Credentials Step by Step

A step-by-step walkthrough of the Safaricom developer portal. Covers registration, getting your consumer key and secret, finding test shortcodes and passkeys, setting up your development environment, and making your first sandbox request.

guide

M-Pesa Callback URLs: Why Yours Is Not Firing

The most common frustration in M-Pesa integration is callbacks that silently never arrive. This guide walks through every cause and how to fix each one.

guide

Going Live on Daraja: The Production Checklist

Everything you need to do before switching from Daraja sandbox to production, including the steps most developers forget until their application gets rejected.

guide

Handling Failed and Duplicate M-Pesa Payments Safely

When payments fail or fire twice, the wrong response can cost you money or trust. This guide covers idempotency, timeout handling, and safe database design for M-Pesa payments.

guide

M-Pesa B2C Payouts: Paying Users From Your App

A complete guide to implementing M-Pesa B2C (Business to Customer) payouts. Send refunds, salary payments, rewards, and cashback directly to user phone numbers through the Daraja API.

guide

Reconciling M-Pesa Transactions With Your Database

Your database says the user paid. M-Pesa says they did not. Or worse, M-Pesa says they paid twice. This guide covers reconciliation strategies to keep your records and M-Pesa in sync, even when things go wrong.

guide

Building a USSD App in Kenya From Scratch

USSD works without internet, runs on any phone, and reaches every Kenyan with a SIM card. This guide walks you through building a USSD application from scratch using Africa's Talking, covering session management, menu design, and deployment.

guide

USSD vs App vs WhatsApp: Choosing the Right Channel in Kenya

Should you build a USSD service, a mobile app, or a WhatsApp bot? The answer depends on your audience, their phones, and their data budgets. This comparison breaks down the three main channels for reaching Kenyan users.

comparison

WhatsApp Business API for Developers: A Kenyan Getting Started Guide

A practical getting started guide for Kenyan developers building on the WhatsApp Business API. We cover BSP options, Meta verification, message templates, pricing, and the Kenya-specific details that the official docs skip.

guide

Daraja vs Third Party Aggregators: What You Give Up

The choice between going direct with Safaricom Daraja and using a payment aggregator is one of the first decisions any Kenyan developer faces. Both work. Both have real tradeoffs. Here is what you actually give up with each option.

comparison

Testing M-Pesa Integrations Without Burning Real Money

You do not need to send real money to test your M-Pesa integration. This guide walks you through the Daraja sandbox, local development with ngrok, mock callbacks for automated testing, and the testing strategies that prevent embarrassing production bugs.

guide

The M-Pesa Integration Portfolio Project That Gets You Hired

A step-by-step guide to building the M-Pesa integration portfolio project that makes Kenyan employers pay attention. Not another to-do app. A real e-commerce checkout with STK Push, payment verification, receipt generation, and an admin dashboard.

guide

How to Become an M-Pesa Integration Developer in Kenya

Every Kenyan business that accepts payments needs someone who can integrate M-Pesa. That someone could be you. This guide walks you through the exact skills, the learning path, and how to start getting paid for M-Pesa integration work.

guide

Why M-Pesa Skills Make Kenyan Developers Hard to Replace

Every online coding course teaches you to integrate Stripe. Almost none teach you Daraja. That gap is your advantage. Here is why M-Pesa skills make you harder to replace, harder to offshore, and more valuable to every Kenyan business that moves money.

guide

Ready to build real-world apps?

Join the McTaba Labs full-stack marathon (4 months full-time · 6 months part-time). Learn M-Pesa, USSD, and WhatsApp engineering while shipping 8 production apps.

Apply to the McTaba Marathon