Back to blog

How to Build a Booking System with M-Pesa Payments

Connect a booking workflow to M-Pesa payments using FortPesa, the Safaricom Daraja API, or IntaSend.

How to Build a Booking System with M-Pesa Payments

What You Are Building

A booking system where customers pick a service, choose a time slot, and pay with M-Pesa before the booking is confirmed. No manual follow-up, no chasing payments over the phone, and no double-booked slots.

This is the exact workflow we walk through in the video, and it works for appointment-based businesses of all kinds: salons and clinics, hotels and rentals, training sessions, events, and service calls.

Why Bookings and Payments Belong Together

Most booking tools stop at collecting a name and a phone number. The business then has to send payment details separately and hope the customer pays. That leaves two problems:

  • Ghost bookings: the customer never pays, and the slot is blocked for everyone else
  • Payment chasing: someone on the team has to follow up manually for every booking

When the booking is only confirmed after payment lands, both problems disappear. The customer gets a clear commitment step, and the business only holds slots that are paid for.

The Three Payment Gateways in the Video

The video builds the same booking flow against three different gateways so you can see where each one fits.

Safaricom Daraja API (Direct)

The official Safaricom API, and the most direct route to M-Pesa. You work with STK Push, which sends a payment prompt straight to the customer's phone during checkout. You get full control over the integration, but you also handle the setup, callbacks, and error states yourself.

FortPesa

A payment gateway built for Kenyan businesses that need M-Pesa without wiring up Daraja from scratch. FortPesa sits between your booking system and Safaricom, giving you a simpler payment step to implement. It is covered in detail in the video because it is the gateway we run ourselves at FortPesa.co.ke.

IntaSend

A gateway that supports M-Pesa alongside other payment methods, which matters if your booking system serves customers who want more than one way to pay. The integration pattern is the same REST-style flow you use with the other two.

The right choice depends on how much control you want versus how fast you need to ship. Direct Daraja gives you the most control, FortPesa gives you the shortest path to M-Pesa, and IntaSend gives you breadth.

How the Pieces Fit Together

The booking and payment flow looks the same no matter which gateway you pick:

  1. Customer selects: they pick the service, date, and time slot
  2. Slot is held: the system temporarily holds the slot while they pay
  3. Payment request: the gateway sends an STK Push prompt to the customer's M-Pesa number
  4. Customer approves: they enter their M-Pesa PIN on their phone
  5. Callback confirms: the gateway notifies your system that the money landed
  6. Booking is confirmed: the slot becomes a real booking and the customer gets confirmation

The important part is step five. Your system should wait for the callback from the gateway before it treats the booking as confirmed. Never mark a booking as paid just because the payment prompt was sent.

Who This Is For

This build is for three kinds of people:

  • Web developers adding payment integrations to client projects
  • Freelancers who want a repeatable booking plus payments package to offer
  • Business owners automating their own bookings without paying for a generic platform that does not fit their workflow

If you can follow a REST API tutorial and you know basic PHP or JavaScript, you can follow the video end to end.

Watch the Full Build

The video walks through the complete build step by step, from the booking table to the live M-Pesa payment. Watch it here and build along:

Want to go deeper on payment integrations? Our M-Pesa Integration Masterclass covers Daraja, STK Push, and C2B flows in full.

Need a booking system built for your business? Our team designs and ships booking workflows with M-Pesa and other payment gateways.

7.7Ksubscribers
50+tutorials
Freeforever

You made it to the end.

Most people don't. Since you're here: we teach this stuff on YouTube, free, every week. 7.7K developers already watch. Pull up a chair.

Watch on @fortunedevacademy

READY TO START
A PROJECT?

Let's discuss your next project.

START A PROJECT