1. Primary M-Pesa WooCommerce Integration Models
When connecting Vodacom M-Pesa to WooCommerce, store managers and WordPress developers in Tanzania have two architectural paths:
| Integration Approach | Supported Providers | Setup Complexity | Payouts & Fees |
|---|---|---|---|
| Direct Vodacom C2B API (Open API / Daraja Framework) | Direct Vodacom Commercial Till / Till Number | High (Requires Developer Keys & SSL Callback Endpoints) | Direct settlement into your corporate Vodacom till account (Lowest per-tx fee). |
| Third-Party Aggregator Plugin | AzamPay, Pesapal, Selcom, DPO Pay | Low (Ready-made WooCommerce Plugin Installation) | Unified settlement across M-Pesa, Tigo Pesa, Airtel Money & Cards (1.5%–3.5% fee). |
2. Option A: Connecting via Third-Party Mobile Money Aggregator (AzamPay / Pesapal)
For most business owners without dedicated development teams, using an accredited aggregator plugin provides the fastest route to market while supporting all Tanzanian mobile networks simultaneously.
-
Register a Business Merchant Account:
Create a merchant account with an approved East African aggregator (such as AzamPay or Pesapal). Submit your business compliance credentials (TIN, BRELA Business Name, and Director ID).
-
Download & Install the WordPress Extension:
In your WordPress Admin Dashboard, navigate to Plugins > Add New. Search for your aggregator's plugin (e.g., AzamPay for WooCommerce or Pesapal WooCommerce Gateway) and click Install & Activate.
-
Retrieve Sandbox & Live API Keys:
Log into your aggregator merchant dashboard. Copy your unique
Consumer Key,Consumer Secret, andApp Name / Till ID. -
Configure WooCommerce Payment Settings:
Go to WooCommerce > Settings > Payments. Enable the Mobile Money / M-Pesa gateway tab and paste your API keys. Toggle the environment mode from Sandbox/Testing to Live Mode once testing is complete.
3. Option B: Direct Vodacom M-Pesa C2B API Integration (STK Push)
If your organization possesses a dedicated Vodacom M-Pesa Lipa Number / Corporate Till and requires zero transaction fee deductions from third parties, configure direct C2B Open API callbacks.
Prerequisites for Direct Vodacom API Access
- Vodacom Business Account: An active Corporate M-Pesa account with an assigned Business Shortcode / Till Number.
- Valid SSL Certificate (HTTPS): Your website must enforce valid HTTPS. Vodacom servers reject unencrypted HTTP API callback URLs.
- Dedicated Web Host: Ensure your hosting account permits outbound port requests and custom POST webhook listeners without web application firewall (WAF) blocking.
Step-by-Step API Configuration Workflow
-
Access the Vodacom Developer Portal:
Register an account on the Vodacom Open API developer platform. Create a new sandbox application to acquire your testing API credentials.
-
Install M-Pesa Open API Plugin for WooCommerce:
Install an accredited M-Pesa C2B plugin in WordPress. Navigate to WooCommerce > Settings > Payments > M-Pesa Open API.
-
Configure Webhook Endpoints:
Copy the automatically generated Callback Listener URL provided by the plugin (e.g.,
https://yourdomain.co.tz/wc-api/mpesa_callback/) and register it inside your Vodacom Portal dashboard under the IPN / Result URL field. -
Test the STK Push Workflow:
In your payment provider’s sandbox, add a test item to your WooCommerce cart and proceed to checkout. Input a Tanzanian Vodacom phone number (e.g.,
0754XXXXXX). Upon placing the order, an automated M-Pesa prompt will trigger on the testing phone requiring the user's PIN.
4. Testing, Webhooks, and Order Status Automation
To deliver an automated customer experience, configure instant order state transitions following payment execution:
| System Action | Initial Order State | Webhook Trigger | Final Order State |
|---|---|---|---|
| Customer clicks Place Order | Pending Payment |
STK Push payload transmitted to Vodacom API | Awaiting PIN entry on user handset |
| Customer enters valid PIN | Pending Payment |
Vodacom sends TRANSACTION_SUCCESS HTTP POST response |
Processing / Completed |
| Customer cancels or enters wrong PIN | Pending Payment |
Vodacom sends INSUSFFICIENT_FUNDS or USER_CANCELLED payload |
Failed / Cancelled |
Developer Note: Always enable logging under WooCommerce > Status > Logs during initial launch. This allows you to inspect raw API response strings if payments remain stuck in Pending Payment state due to firewall blocking or misconfigured webhook callback URLs.