Skip to content
Mctaba Academy

Intermediate · Payments

M-Pesa Integration for Developers

The definitive guide to building payment systems with Safaricom's Daraja API, from your first STK Push to production-grade payment infrastructure.

  • 10 modules
  • 57 lessons
  • 25-30 hours
  • 4.9 rating
  • Certificate included

Taught by Bonaventure Ogeto, Founder, Mctaba Labs

What you'll learn

  • Foundations
  • Authentication
  • Stk Push
  • C2b Payments
  • B2c Disbursements
  • Transaction Queries
  • Webhooks Deep Dive
  • Testing And Sandbox
  • Going To Production
  • Capstone Paylink

Curriculum

10 modules · 57 lessons · 16.6 hrs total · 2 free preview lessons

Foundations5 lessons · 1.3 hrs
  • Lesson 1.1: What is M-Pesa and the Daraja API?Free13 min
  • Lesson 1.2: How M-Pesa Works TechnicallyFree16 min
  • Lesson 1.3: Setting Up Your Daraja Developer Account (locked)13 min
  • Lesson 1.4: Understanding the Daraja API Architecture (locked)16 min
  • Lesson 1.5: Your First API Call -- Getting an Access Token (locked)18 min
Authentication4 lessons · 1 hr
  • Lesson 2.1: OAuth in the Context of Daraja (locked)13 min
  • Lesson 2.2: Building a Reusable Auth Module (locked)15 min
  • Lesson 2.3: Token Caching and Refresh Strategies (locked)17 min
  • Lesson 2.4: Securing Your Credentials (locked)17 min
Stk Push6 lessons · 1.7 hrs
  • Lesson 3.1: How STK Push Works (Full Lifecycle) (locked)14 min
  • Lesson 3.2: Building STK Push from Scratch (locked)19 min
  • Lesson 3.3: Handling STK Push Callbacks (locked)14 min
  • Lesson 3.4: Polling vs Webhooks — Checking Payment Status (locked)17 min
  • Lesson 3.5: STK Push Error Handling — Everything That Can Go Wrong (locked)19 min
  • Lesson 3.6: Building a Payment Form UI (locked)21 min
C2b Payments5 lessons · 1.6 hrs
  • Lesson 4.1: C2B vs STK Push — When to Use Which (locked)15 min
  • Lesson 4.2: Registering C2B URLs (locked)16 min
  • Lesson 4.3: Handling Validation and Confirmation (locked)22 min
  • Lesson 4.4: Paybill vs Till Number (locked)17 min
  • Lesson 4.5: Reconciling C2B Payments (locked)23 min
B2c Disbursements4 lessons · 1.4 hrs
  • Lesson 5.1: When to Use B2C (locked)15 min
  • Lesson 5.2: Building B2C Payouts (locked)18 min
  • Lesson 5.3: B2C Callbacks and Status (locked)20 min
  • Lesson 5.4: B2C Security and Limits (locked)28 min
Transaction Queries4 lessons · 1.3 hrs
  • Lesson 6.1: Transaction Status API (locked)17 min
  • Lesson 6.2: Account Balance API (locked)17 min
  • Lesson 6.3: Reversal API (locked)18 min
  • Lesson 6.4: Building a Transaction Dashboard (locked)23 min
Webhooks Deep Dive5 lessons · 1.4 hrs
  • Lesson 7.1: Webhook Architecture (locked)16 min
  • Lesson 7.2: Securing Webhooks (locked)16 min
  • Lesson 7.3: Retry Logic and Idempotency (locked)16 min
  • Lesson 7.4: Logging and Debugging Callbacks (locked)17 min
  • Lesson 7.5: ngrok and Local Development (locked)16 min
Testing And Sandbox4 lessons · 1.4 hrs
  • Lesson 8.1: The Daraja Sandbox Deep Dive (locked)16 min
  • Lesson 8.2: Simulating All Scenarios (locked)22 min
  • Lesson 8.3: Writing Automated Tests (locked)22 min
  • Lesson 8.4: Common Sandbox Pitfalls (locked)23 min
Going To Production5 lessons · 1.6 hrs
  • Lesson 9.1: Safaricom's Go-Live Process (locked)15 min
  • Lesson 9.2: Production Credentials (locked)16 min
  • Lesson 9.3: Production Checklist (locked)19 min
  • Lesson 9.4: Monitoring and Alerting (locked)20 min
  • Lesson 9.5: Handling Production Failures (locked)24 min
Capstone Paylink10 lessons · 3.3 hrs
  • Lesson 10.1: Project Overview and Architecture (locked)19 min
  • Lesson 10.2: Backend Setup and Database (locked)25 min
  • Lesson 10.3: Payment Link Generation (locked)16 min
  • Lesson 10.4: STK Push Integration (locked)22 min
  • Lesson 10.5: Callback Handling and Status (locked)21 min
  • Lesson 10.6: PDF Receipt Generation (locked)18 min
  • Lesson 10.7: React Frontend — Dashboard (locked)20 min
  • Lesson 10.8: Payment Page and Polling (locked)20 min
  • Lesson 10.9: Deployment to Production (locked)17 min
  • Lesson 10.10: Extensions and Next Steps (locked)17 min
Appendices5 lessons · 54 min
  • Appendix A: Daraja Error Codes Reference (locked)13 min
  • Appendix B: M-Pesa Phone Number Formatting (locked)9 min
  • Appendix C: Timestamp and Password Generation (locked)11 min
  • Appendix D: Environment Variables Template (locked)8 min
  • Appendix E: Glossary (locked)13 min

This course includes

  • 57 lessons across 10 modules
  • 25-30 hours
  • Certificate of completion
  • 12-month access
  • Works on phone, tablet and desktop

Want live classes and mentors?

The Mctaba bootcamp adds live classes, dedicated mentors and career support.

Apply at mctaba.com →

Frequently asked questions

How long do I have access?

12 months from the date of purchase. You can renew access or subscribe to All-Access for KES 2,999/month for unlimited access to every course except Full-Stack + AI Engineering, which is sold separately.

What payment methods do you accept?

M-Pesa and international cards (Visa, Mastercard) via Paystack.

Can I preview content before buying?

Yes! The first two lessons are free to preview. No purchase required.

Who teaches this course?

Bonaventure Ogeto, founder of Mctaba Labs, a Nairobi-based software company that builds the tools and products we teach about.

Stay updated

Enter your email to receive updates about this course.

KES 9,99912-month access

Enrol now

or subscribe to All-Access for KES 2,999/mo