Logo Lanfrica

stevehoober254/kcb-mpesa-express-wordpress-plugin

Domaine:

digital infrastructure

Type de record:

software
Créateur:
ste
Hôte:
Custom WooCommerce payment gateway for KCB M-Pesa STK Push API. # 💳 KCB M-Pesa Express WooCommerce Gateway > A production WordPress plugin enabling KCB M-Pesa STK Push payments in WooCommerce stores across Kenya and East Africa. Free core + Pro tier with extended features. **Why this exists:** KCB's M-Pesa Express API is widely used in Kenya but has no official WooCommerce integration. This plugin fills that gap with a clean, extensible implementation. --- ## Features ### Free - ✅ Full STK Push payment flow at WooCommerce checkout - ✅ Secure OAuth2 token generation with KCB API - ✅ Real-time callback handling → automatic order status updates - ✅ Admin callback log dashboard (view, download, clear) - ✅ Email alerts on payment failures ### Pro - 🔐 License key activation system - 📊 CSV export of payment logs - 📣 Slack / Telegram payment notifications (planned) - 🎨 Advanced checkout UI customisation --- ## Architecture ``` kcb-mpesa-gateway/ ├── admin/ │ └── logs-ui.php # Admin log dashboard ├── includes/ │ ├── class-gateway-base.php # Abstract base — extensible for other M-Pesa providers │ ├── class-gateway-free.php # Free tier implementation │ └── class-gateway-pro.php # Pro tier with licence check ├── pro/ │ └── class-license-manager.php ├── kcb-mpesa-gateway.php # Plugin entry point └── init_kcb-mpesa-gateway.php # Gateway registration + callback endpoint ``` **Design decisions:** - Abstract base class (`class-gateway-base.php`) makes it straightforward to extend for other KCB payment products or M-Pesa providers - Callbacks are logged to a flat file (`wp-content/mpesa-callback-log.txt`) — avoids DB write overhead during high-volume payment events - Token generation is handled per-request with short TTL — avoids stale token issues that plague many community implementations --- ## Installation 1. Upload to `/wp-content/plugins/kcb-mpesa-gateway` 2. Activate via **Plugins** in WordPress admin 3. Go to **WooCommerce → Settings → Payments** → enable **KCB M-Pesa** 4. Enter you …