Free .co.ke Domain on Business Plans →
August 6, 2025

How to Add M-Pesa Checkout to Your Website

How to Add M-Pesa Checkout to Your Website

Adding M-Pesa checkout involves a mix of business setup and technical integration. Here's the realistic path from nothing to a working "Pay with M-Pesa" button.

Step 1: Register a Paybill or Till Number

You'll need a registered Safaricom paybill or till number tied to your business — this is where customer payments actually land.

Step 2: Get Daraja API Access

Register for API access through Safaricom's Daraja developer portal, which provides the credentials needed to trigger STK Push and receive payment confirmations programmatically.

Step 3: Choose Your Integration Path

Build a direct integration yourself (or with a developer), or use an aggregator like PesaPal that's already built the Daraja connection and handles it on your behalf — see our comparison of the two approaches.

Step 4: Build or Configure the Checkout Flow

The customer enters their phone number, your system triggers STK Push, and your site waits for the payment confirmation callback before marking the order complete.

Step 5: Test Thoroughly

Test the full flow — including failed and cancelled payments, not just successful ones — before going live, since edge cases are where most integration bugs hide.

Step 6: Go Live

Once tested, switch from Safaricom's sandbox/test environment to live credentials and you're accepting real M-Pesa payments.

Skip the Technical Work

If building this yourself sounds like more than you want to take on, our online shop design service and eCommerce hosting include working M-Pesa checkout from day one.