Back to Blog
Kenya
4 min read

How to sell things online in Nairobi: A beginner's guide to M-Pesa checkouts

A simple look at how any shop in Kenya can start taking payments directly on their website using M-Pesa.

How to sell things online in Nairobi: A beginner's guide to M-Pesa checkouts

Selling things online in Nairobi is no longer just about having an Instagram page or a WhatsApp group. To truly scale, a business needs a professional e-commerce system that can handle transactions while the owner sleeps. The most critical part of this system for any Kenyan merchant is the payment gateway, and in our market, that means M-Pesa.

The Shift from Manual to Automated Payments

In the early days of Kenyan e-commerce, the process was manual and full of friction. A customer would find a product, message the seller, receive a Paybill number, send money, and then—the most annoying part—manually type or screenshot the transaction code to the seller. This process is slow, prone to errors, and results in high cart abandonment rates.

Today, technical excellence in e-commerce means removing this friction. By implementing an automated M-Pesa checkout, you allow the customer to simply enter their phone number and receive an STK Push prompt on their screen. They enter their PIN, and the website immediately confirms the order. This is the "Gold Standard" for Nairobi-based online shops.

The Technical Foundation

Building this requires more than just a simple plugin. It requires a robust backend architecture. Typically, I use a Node.js environment to communicate with Safaricom’s Daraja API. The process involves generating an OAuth token, initiating the LNM (Lipa Na M-Pesa) request, and most importantly, handling the callback.

The callback is where most amateur builds fail. Safaricom sends a JSON payload to your server once the customer completes the payment. Your server must be ready to receive this, validate the transaction ID, and update the order status in real-time. Without a stable server setup (often managed with PM2 on a VPS), you risk losing track of paid orders, which destroys customer trust.

Why This Matters for Your Business

When you automate your payments, you aren't just saving time; you are increasing your conversion rate. Customers in Westlands, Kilimani, or even the CBD are busy. They want to click "Buy" and be done. If they have to switch apps to find a Paybill number, you might lose them to a distraction.

Furthermore, a professional checkout system feeds into your broader business automation. Once a payment is confirmed, your system can automatically notify your delivery partner, update your inventory, and send a branded invoice via a tool like InvoiceNow. This is the level of integration that turns a small side-hustle into a scalable e-commerce engine.

Security and Trust

Selling online in Nairobi also comes with security concerns. Customers are wary of fraud, and merchants are wary of fake transaction messages. An API-based integration eliminates "fake SMS" fraud because the transaction is verified directly by Safaricom's servers before the order is ever marked as "Paid" in your system.

To protect your site further, I always recommend implementing hardened security protocols like CSP and HSTS. This ensures that the data flowing between your customer’s phone and your server is encrypted and safe from interception. You can learn more about my approach to infrastructure security in my Services section.

Moving Forward

If you are currently selling via Instagram and want to move to a more professional setup, the first step is to look at your technical architecture. Are you building a "brochure" website, or are you building an e-commerce machine?

In my experience building systems like the Browns Pharmacy E-commerce, the difference lies in the details—how you handle the catalog, how you secure the payments, and how you automate the boring stuff. Nairobi is ready for world-class e-commerce; make sure your tech stack is too.

Conclusion

The 2026 technical roadmap for East African e-commerce is clear: automation, security, and mobile-first logic. By integrating M-Pesa directly into your build, you are taking the most important step toward professionalizing your brand. Don't let manual workflows hold you back from the thousands of potential customers looking for your products today.

For a deeper look at how I can help you build these systems, explore my E-commerce Engineering Services.

WhatsApp
Get in touch