Logo Lanfrica

stevehoober254/kcb-mpesa-express-wordpress-plugin

Domain:

digital infrastructure

Record type:

software
Creator:
ste
Host:
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 …