How to Add M-Pesa, Tigo Pesa, and Airtel Money to WooCommerce and Shopify in Tanzania
For WooCommerce, use a payment gateway plugin from a Tanzanian aggregator like Selcom, Azampay, or Pesapal. These plugins add M-Pesa, Tigo Pesa, and Airtel Money as checkout options. For Shopify, you need a Shopify-compatible payment provider that supports Tanzanian mobile money; Pesapal offers Shopify integration, and some aggregators provide custom integration options. If no existing plugin meets your needs, a developer can build a custom WooCommerce payment gateway that connects to any aggregator API. Custom Shopify payment apps require Shopify Plus or the Payments Apps API.
Why Standard E-Commerce Platforms Miss Tanzania
WooCommerce and Shopify are built for card payments. Their default checkout flows expect a credit card number, expiry date, and CVV. This works for North American and European markets. It does not work for Tanzania, where the majority of digital transactions happen through mobile money.
The result: many Tanzanian businesses set up a WooCommerce or Shopify store, install a nice theme, add their products, and then realize their customers have no way to pay. The built-in payment gateways (Stripe, PayPal, Shopify Payments) do not support M-Pesa, Tigo Pesa, or Airtel Money.
Solving this requires a payment gateway that connects your store to Tanzanian mobile money rails. On WooCommerce, this means a plugin. On Shopify, it means a compatible payment provider or a custom payment app. Both approaches connect your store to an aggregator (Selcom, Azampay, ClickPesa, or Pesapal) that handles the actual mobile money transactions.
WooCommerce: Plugins and Custom Gateways
WooCommerce (WordPress) is the more flexible option for Tanzanian mobile money. You have three paths:
1. Use an existing aggregator plugin
Several Tanzanian aggregators offer WooCommerce plugins:
- Pesapal: Has an official WooCommerce plugin that supports mobile money and card payments across East Africa, including Tanzania. Install the plugin, enter your Pesapal API credentials, and mobile money appears as a checkout option.
- Selcom: Offers WooCommerce integration. Check their developer documentation for the current plugin or integration guide.
- Azampay: Provides integration options for WooCommerce. Their API documentation covers the setup process.
The aggregator plugin approach is the fastest. Install, configure, test, and go live. The plugin handles the payment flow, callbacks, and order status updates.
2. Build a custom WooCommerce payment gateway
WooCommerce allows custom payment gateways through its WC_Payment_Gateway class. You write a PHP plugin that extends this class, connects to any aggregator API you choose, and handles the payment flow. This gives you full control over the checkout experience.
Building a custom gateway requires PHP skills and understanding of the WooCommerce payment gateway API. The mobile money logic is the same as any integration: send a payment request, handle the callback, update the order status.
3. Use a redirect-based payment page
Some aggregators offer hosted payment pages. The customer is redirected from your WooCommerce checkout to the aggregator's payment page, completes the payment there, and is redirected back to your store. This requires minimal custom code but takes the customer off your site during payment.
Shopify: More Restrictive, Still Possible
Shopify is more locked down than WooCommerce when it comes to custom payment gateways. You cannot simply install a PHP plugin. Shopify controls the checkout experience.
Your options:
1. Use a Shopify-compatible payment provider
Pesapal is available as a payment provider on Shopify in East Africa. If Pesapal supports your needs, this is the simplest path: enable Pesapal in your Shopify payment settings, configure your API credentials, and mobile money appears at checkout.
Check the Shopify Payments directory for other providers that support Tanzanian mobile money. The available options change as aggregators add Shopify support.
2. Shopify Payments Apps API
Shopify's Payments Apps API allows developers to build custom payment integrations. This is an API-based approach where you build an app that connects Shopify's checkout to your aggregator of choice. It requires development skills and access to the Payments Apps API, which has specific requirements.
3. Manual payment with order notes
The low-tech workaround: display mobile money payment instructions at checkout ("Send TZS X to Paybill Y with reference Z"), and manually confirm payments. This works for very low volume but does not scale and creates friction for customers.
4. Alternative: Custom-built checkout
If Shopify's payment limitations are a dealbreaker, consider whether a custom-built e-commerce site with mobile money baked into the checkout might serve you better. A React + Node.js store with a direct aggregator integration gives you complete control. Our e-commerce checkout guide covers this approach.
The Async Payment Challenge in CMS Platforms
Both WooCommerce and Shopify expect payment to resolve during the checkout flow: the customer clicks "Pay," the payment processes, and the order is confirmed. Mobile money breaks this expectation because the payment requires the customer to confirm on their phone, which takes 10 to 60 seconds.
A good mobile money plugin must handle this:
- Show a waiting state. After the customer submits payment, display a message like "A payment prompt has been sent to your phone. Please enter your PIN to confirm." Do not redirect to a blank "thank you" page before payment is confirmed.
- Poll for status. The checkout page should poll the backend every few seconds to check if the callback has arrived. When it has, update the page to show success or failure.
- Handle timeouts. If the customer does not confirm within 60 to 90 seconds, show a timeout message with a retry option.
- Process callbacks. The aggregator sends a callback to a URL on your server. The plugin must expose this endpoint and update the WooCommerce or Shopify order status accordingly.
Not all plugins handle this well. Some redirect the customer to a "thank you" page immediately and only update the order status when the callback arrives later. This creates confusion: the customer sees "Order received" but the payment has not been confirmed. Test any plugin thoroughly before going live.
WooCommerce vs Shopify for Tanzanian E-Commerce
If you are starting a new Tanzanian e-commerce store and mobile money is your primary payment method, here is the honest comparison:
WooCommerce is better for mobile money flexibility. You have more plugin options, you can build a custom gateway, and you have full control over the checkout experience. The tradeoff: WooCommerce requires WordPress hosting, more maintenance, and more technical skill to run.
Shopify is easier to manage but more restrictive on payments. The platform handles hosting, security, and performance. The tradeoff: you are limited to Shopify-compatible payment providers, and custom payment integrations require more advanced development.
For a Tanzanian store where mobile money is the primary (or only) payment method, WooCommerce typically gives you more options. For a store where mobile money is one of several payment methods and you value platform simplicity, Shopify with Pesapal is a valid choice.
A third option: build a custom store. If you or your developer can build a React + Node.js application with a direct aggregator integration, you get complete control over the checkout, the payment flow, and the customer experience. This is more work upfront but eliminates the limitations of both WooCommerce and Shopify. McTaba's Full-Stack course (KES 120,000 / ~TZS 2,400,000) teaches you how to build this from scratch.
Next Steps
If you are adding mobile money to an existing WooCommerce or Shopify store:
- Check aggregator compatibility. Visit the websites of Selcom, Azampay, ClickPesa, and Pesapal. Look for WooCommerce plugins or Shopify integration guides. Sign up for their sandboxes.
- Install and test in a staging environment. Do not test payment integrations on a live store. Set up a staging copy, install the plugin, configure sandbox credentials, and test the full flow: add to cart, checkout, enter phone number, simulate payment, verify order status update.
- Test all three providers. A plugin that works for M-Pesa but fails for Tigo Pesa is only two-thirds of a solution. Test with phone numbers from all three providers.
- Go live with small amounts. After sandbox testing, switch to production credentials and test with real but small payments (TZS 1,000 to TZS 5,000). Verify that real callbacks arrive and orders update correctly.
If you need a custom gateway built, the M-Pesa Integration course (KES 9,999 / ~TZS 200,000) at McTaba Academy teaches the payment integration pattern. The PHP/WooCommerce adaptation uses the same architecture you learn in the course, applied to WooCommerce's gateway framework.
Key Takeaways
- ✓WooCommerce has the most flexible mobile money integration options in Tanzania. Several aggregators (Selcom, Pesapal, Azampay) offer WooCommerce plugins or you can build a custom payment gateway.
- ✓Shopify is more restrictive. Custom payment gateways require Shopify Plus or the Payments Apps API. Pesapal and some aggregators offer Shopify-compatible integration options.
- ✓Any mobile money plugin or gateway must handle the async payment flow: initiate the payment, show a waiting state, poll for the result, and update the order status when the callback arrives.
- ✓If you need a custom gateway built, the skills come from understanding mobile money APIs and PHP (WooCommerce) or the Shopify API. McTaba teaches the payment integration pattern in the M-Pesa Integration course (KES 9,999 / ~TZS 200,000).
Frequently Asked Questions
- Can I use the same mobile money plugin for Kenya and Tanzania?
- It depends on the aggregator. Pesapal works across East Africa, so one Pesapal plugin covers both Kenya and Tanzania. Selcom and Azampay are Tanzania-focused and do not cover Kenya. If you run stores in both countries, you may need different payment providers for each, or use a pan-African aggregator like Pesapal or Flutterwave.
- How much does a custom WooCommerce payment gateway cost to build?
- A custom WooCommerce payment gateway that connects to one aggregator and supports all three Tanzanian mobile money rails typically takes a developer 2 to 5 days to build and test. At local developer rates, that could be TZS 500,000 to TZS 2,000,000 depending on the developer. If you learn to build it yourself through McTaba's courses, the cost is the course fee and your time.
- What about using a paybill number and manual confirmation?
- Some Tanzanian stores ask customers to send a manual M-Pesa payment to a paybill number and then enter the transaction code on the website. This works but creates friction: customers must switch between your site and their phone, manually enter a reference, and wait for manual confirmation. Automated payment integration removes all of this friction. It is worth the development investment for any store doing more than a handful of orders per day.
Ready to build real-world apps?
Join the McTaba Labs full-stack marathon (4 months full-time · 6 months part-time). Learn M-Pesa, USSD, and WhatsApp engineering while shipping 8 production apps.
Apply to the McTaba Marathon