PamojaPay for WooCommerce
PamojaPay is a WordPress supported plugin for WooCommerce.
by Joseph Akaro · github.com/joseph-akaro/pamojapay-woocommerce · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/joseph-akaro/pamojapay-woocommerce/archive/refs/heads/main.zipPamojaPay for WooCommerce
Contributors: Joseph Akaro Requires at least: WordPress 6.5, WooCommerce 8.0, PHP 7.4 Tested up to: WordPress 7.0, WooCommerce 9.5 Stable tag: 1.3.0 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html
A secure and seamless M-Pesa payment gateway for WooCommerce. PamojaPay integrates directly with the Safaricom Daraja API to provide a smooth STK Push payment experience for your customers.
Description
PamojaPay for WooCommerce allows your e-commerce store to accept payments via M-Pesa, Kenya's most popular mobile money service. The plugin uses the "STK Push" method, meaning customers receive a payment prompt directly on their phone and simply need to enter their M-Pesa PIN to authorize the payment. This eliminates the need for customers to manually enter Paybill numbers and account details, reducing errors and improving the checkout experience.
Key Features
Seamless STK Push: Customers are prompted on their phone to complete the payment.
Sandbox & Live Modes: Easily switch between the Safaricom Sandbox environment for testing and the Live environment for real transactions.
Automatic Order Updates: The plugin listens for the callback from Safaricom's API to automatically update the order status to "Processing" on successful payment or "Failed" if the transaction is unsuccessful.
Secure Credential Storage: API keys are stored securely in the WordPress database.
Easy Configuration: A simple settings page integrated into WooCommerce settings.
Installation
Download the Plugin: Download the pamojapay-for-woocommerce folder as a .zip file.
Go to your WordPress Dashboard: Navigate to Plugins > Add New.
Upload Plugin: Click the Upload Plugin button at the top of the page.
Choose File: Select the .zip file you downloaded in step 1.
Install and Activate: Click Install Now and then Activate Plugin.
Configuration
Before you can start accepting payments, you need to configure the plugin with your Safaricom Daraja API credentials.
Get Your Credentials:
Log in to the Safaricom Daraja Developer Portal.
Go to My Apps and create a new app.
Select the Lipa Na M-PESA Sandbox APIs.
Once the app is created, you will find your Consumer Key and Consumer Secret.
For the Business Shortcode and Passkey, use the test credentials provided in the Daraja portal documentation for the sandbox environment.
Enter Credentials in WooCommerce:
In your WordPress dashboard, navigate to WooCommerce > Settings > Payments.
Find PamojaPay (M-Pesa STK Push) and click Manage.
Enable the payment gateway.
Set the Title and Description that customers will see during checkout.
Select the Environment (Sandbox for testing, Live for production).
Enter your Consumer Key, Consumer Secret, Business Shortcode, and Lipa Na M-Pesa Passkey.
Click Save changes.
How It Works (Customer Flow)
The customer adds products to their cart and proceeds to the checkout page.
They select "PamojaPay (M-Pesa)" as their payment method.
They confirm that their billing phone number is the correct M-Pesa number and click Place Order.
A payment prompt is automatically sent to their phone from M-Pesa.
The customer enters their M-Pesa PIN on their phone to authorize the transaction.
Once the payment is complete, their order is confirmed on your website, and the order status is updated.
File Structure
The plugin is organized with a clean and maintainable file structure:
pamojapay-for-woocommerce/
│
├── main.php # Main plugin file (entry point)
│
├── includes/
│ ├── gateway.php # Handles WooCommerce settings and checkout process
│ ├── api-handler.php # Handles all communication with the Daraja API
│ └── callback-handler.php # Handles incoming payment status updates from Safaricom
│
└── assets/
└── pamojapay-logo.png # Logo displayed at checkout
Changelog
v1.3.0
Refactored file names for better clarity and organization (main.php, gateway.php, etc.).
v1.2.0
Rebranded plugin from "M-Pesa for WooCommerce" to "PamojaPay for WooCommerce".
Updated all class names, file names, and text domains.
v1.1.0
Updated plugin headers for compatibility with latest WordPress and WooCommerce versions.
v1.0.0
Initial release.