If your business website isn't built on WordPress, you can still accept M-Pesa payments from customers. You have two practical options: a simple manual process that needs no coding, or a fully automated payment flow built against Safaricom's M-Pesa payment system. This guide covers both, so you can pick the one that matches how your business actually takes orders.
If your site runs on WordPress, a plugin-based setup is usually quicker. See How to Add M-Pesa Payments to Your WordPress Website instead.
Option 1: A Manual M-Pesa Payment Notice (No Coding Required)
This is the fastest way to start accepting M-Pesa on a custom-coded or static website. You display your payment details and confirm each payment yourself before fulfilling the order.
- On your checkout or order page, clearly display your Paybill Number or Till Number, along with the exact Account Number format you want customers to use (for example, their order number).
- Add a short set of instructions explaining how to complete the payment from the M-Pesa menu on the customer's phone.
- Add a simple form asking the customer to submit the M-Pesa transaction code (the confirmation message code, usually starting with a letter followed by numbers) along with their order details.
- Check the transaction code against your M-Pesa statement or paybill portal before you mark the order as paid and proceed with fulfillment.
Never mark an order as paid just because a customer says they've sent money. Always confirm the transaction code against your own M-Pesa records first, since mistyped or duplicated codes are common.
Option 2: Automated M-Pesa Payments (STK Push)
If you process many orders and manual checking isn't practical, you can integrate your website directly with Safaricom's M-Pesa payment system so customers get an automatic prompt (commonly called an STK Push) on their phone to enter their M-Pesa PIN and complete payment instantly.
This option requires custom development work. It isn't something you add with a plugin, since your website needs to talk directly to Safaricom's payment API over a secure connection.
- Make sure your Paybill or Till number is registered for online API payments, not just manual till payments. You may need to apply for this separately with Safaricom or through your bank.
- Have a developer build the integration using Safaricom's official M-Pesa developer API, or use a licensed payment gateway that already supports M-Pesa and offers ready-made integration code for your platform.
- Set up a secure callback (confirmation) endpoint on your server. This is the piece that receives Safaricom's payment confirmation and is the only place that should ever mark an order as "paid."
- Test the full flow in a sandbox or test environment before accepting real customer payments, including what happens when a payment fails, times out, or is cancelled by the customer.
Keep your API keys and secrets on your server, never in your website's front-end code. A payment should only be confirmed as successful after your server verifies it directly with Safaricom, not based on anything sent from the customer's browser.
Which Option Should You Choose?
If you take occasional orders or you're just getting started, the manual notice is enough and costs you nothing extra. If you're processing frequent online orders and manual checking is slowing you down or causing errors, the automated STK Push setup is worth the development investment.
If you'd rather have this built for you instead of doing it in-house, ZIPROF's software and systems development service can set up a custom M-Pesa payment integration for your website.