What you will learn
You will build a working M-Pesa payment system, from the first page a customer lands on to the callback that tells your app the money arrived.
- A storefront that takes an order and fires an M-Pesa prompt at the customer
- A backend that authenticates against the Daraja API with OAuth 2.0
- STK Push, callback handling and payment status tracking
- A database of customers, orders and payments
- An admin view showing what was paid and what failed
You build it in PHP and JavaScript, because both jobs get done in Kenyan agencies. PHP for the classic sites that already carry the business, JavaScript for the modern API layer.
How the twelve weeks are built
Three tracks run in parallel, and every week ends with a project that runs.
Frontend HTML5 and CSS3 first, then JavaScript, the DOM, forms, fetch and JSON, UI components, authentication screens, dashboards and optimization.
Backend PHP at the start so the fundamentals land, then Node.js and Express, REST APIs, databases, CRUD, authentication, authorization, deployment, environment variables and testing.
Daraja The developer portal and sandbox, getting your credentials, OAuth access tokens, what an STK Push really does, implementing it, callback URLs, payment status handling, what changes when you go live, and testing payment flows end to end.
The twelve weeks, phase by phase
Weeks 1 to 3, the foundations HTML5 structure and forms, CSS3 and responsive design, JavaScript fundamentals. On the server, how the web works, PHP basics, HTTP and APIs, then Node.js setup. On the Daraja side, what M-Pesa and Daraja are, the developer portal and the sandbox. Projects: a business website, a responsive landing page and an interactive frontend.
Weeks 4 to 6, your first API and your first payment The DOM, events and forms, Express routing, REST APIs, database fundamentals, modern JavaScript and UI components. Then the Daraja part that matters: your credentials, OAuth access tokens and STK Push concepts. Projects: a frontend talking to a backend, then a payment initiation system.
Weeks 7 to 9, the full payment flow Frontend project structure, authentication UI, user authentication, authorization and dashboard design. On the Daraja side, implementing STK Push for real, callback URLs and payment status handling. Projects: customer and payment records, a login plus payment flow, and an admin dashboard.
Weeks 10 to 12, shipping it Optimization, deployment, environment variables, final project work, testing and debugging, and presentation. Daraja production considerations, advanced integration and testing payment flows. You deploy the full-stack application, complete your M-Pesa application and present the finished project.
Who is this course for?
- PHP developers who now need to take M-Pesa payments
- JavaScript and Node.js developers adding payments to an existing app
- Freelancers and agencies building payment pages for Kenyan clients
- Anyone who has copied Daraja code from a blog and still does not know what arrives on the callback
What you need
- A laptop and a browser. Nothing exotic.
- An M-Pesa phone number for the payment steps, yours or a test one.
- A Safaricom Daraja developer account. Week 4 walks you through getting one, and you can apply while you follow the course.
- Basic programming sense. You should have written a function before. You do not need to be a senior engineer.
How access works
- Pay once with M-Pesa at checkout.
- Sign in or create an account with the same email address.
- Every lesson opens on the course page and stays open. Come back to week 7 whenever you need it.
There are no live sessions to attend and nothing to renew. Episode 1 is free, so you can judge the teaching before you pay.
Questions people ask
Do I need to know PHP already? No. Week 1 introduces PHP from zero. If you already write PHP you will move faster, but you will not be lost.
Is this live or recorded? Recorded video lessons. Watch them in order, pause, and repeat the part you need.
Do I get the source code? You write it. Each lesson walks through the code for that step, and every week ends with a project that runs.
How long do I have access? Your account keeps the lessons for as long as the site is running. There is no expiry date on your purchase.
What if I am not ready for the Daraja account? Week 4 is dedicated to your credentials and the sandbox. You can follow the whole course before your production credentials are approved.
What happens if my M-Pesa payment does not go through? You see it on the checkout page straight away and you can retry. Nothing is delivered until the payment confirms.
Still deciding?
Start with Episode 1. It is free and it is the same teaching you get in the paid weeks.
If you would rather talk it through first, WhatsApp us on 0740 408 496.
This is independent developer education and is not an official Safaricom training programme.