Software / / 6 min read

Taking M-Pesa on your website: what it involves

The two ways to accept M-Pesa on a business website, what Safaricom needs before you go live, and the parts of the job most quotes leave out.

If your customers pay by M-Pesa in person, they will expect to pay by M-Pesa online. Adding it to a website is very doable, but it is not a plugin you switch on: it is a small piece of software with a real approval process behind it. Here is what is actually involved, so you can judge a quote.

The two routes

Ways to accept M-Pesa on a website
RouteHow it worksBest for
Payment gatewayA gateway handles M-Pesa (and usually cards) for you and pays out to your account, minus a fee on each transaction.Getting live quickly, taking cards as well, low transaction volumes.
Direct, through Safaricom's Daraja APIYour site asks Safaricom to send a payment prompt to the customer's phone. They enter their PIN and the money lands in your own Paybill or Till.Businesses that already have a Paybill or Till and want the money to arrive directly.
Ways to accept M-Pesa on a website

Neither is better in general. A gateway trades a per-transaction fee for speed and less paperwork. Going direct keeps the money flow in your own Safaricom account but puts the integration and its approval on you. Compare the gateway's current fees with Safaricom's own tariff for your account before choosing; both change, so check them at the time.

What Safaricom needs before you go live (direct route)

  1. A live M-Pesa shortcode: your business Paybill or Till number. The integration is tied to it.
  2. An administrator account for that shortcode on Safaricom's Daraja developer portal, set up through Safaricom's M-Pesa business team.
  3. A working test integration in Daraja's sandbox, so the payment prompt, success, failure and cancellation have all been tried.
  4. A go-live request through the Daraja portal, with the business documents Safaricom asks for at the time.
  5. Public HTTPS addresses on your site where Safaricom can send each payment's result. A site that cannot receive these cannot confirm a single payment.

The parts most quotes leave out

  • What happens when a customer closes the prompt, types the wrong PIN, or has too little balance. Each needs a clear message and a way to try again.
  • Payments that succeed but whose confirmation arrives late or not at all. Someone has to be able to check and reconcile them.
  • Order and receipt emails or SMS, so a customer has proof they paid.
  • Who holds the Daraja credentials, and what happens to them if you change developers. They belong to your business, not to the person who built the site.
  • Testing on a real phone with a real small payment before launch, not only in the sandbox.

Do you need it at all?

Not always. If most of your sales start with a conversation, a clear price list and a WhatsApp button with your Paybill or Till number written on the page may serve customers just as well, at no build cost. Online M-Pesa earns its keep when people want to pay without talking to you first: fixed-price products, bookings, deposits and repeat orders.

Have a project in mind?

Want this applied to your site?

Send your current site, or your Instagram if that is all there is, and I will tell you what is costing you enquiries.