Articles · Payments · 5 min read

How to set up M-Pesa on your website

By Ken Murithi · 5 February 2026

PAYMENTS

Accepting M-Pesa on a website is not as simple as pasting a paybill number. Done properly, it is smooth. Done carelessly, customers get charged and orders vanish.

What you need

A Safaricom Daraja account with API credentials, a paybill or till, and a website that can send a payment request and receive the result. For a business, a Lipa na M-Pesa Online (STK push) setup gives the cleanest customer experience.

The part most people get wrong

The order must only be marked paid when Safaricom confirms it through a callback, not when the PIN prompt is sent. Without a reliable callback handler, money leaves the customer's account and the order never updates.

Test with real money first

Always run real low-value transactions before launch and confirm every one reconciles correctly. This is the step that separates a payment flow that works from one that quietly loses sales.

Building something for the East African market?

Talk to us