Download the PHP package james-kabz/mpesapkg without Composer
On this page you can find all versions of the php package james-kabz/mpesapkg. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download james-kabz/mpesapkg
More information about james-kabz/mpesapkg
Files in james-kabz/mpesapkg
Package mpesapkg
Short Description Laravel package for integrating Safaricom M-Pesa APIs
License MIT
Informations about the package mpesapkg
MpesaPkg (Laravel)
Plug-and-play M-Pesa package with STK, B2C, C2B, and utility APIs. Includes request/response persistence, callback storage, and optional webhook validation.
Quick Start
1) Publish config (optional):
2) Run migrations:
3) Place certificates:
4) Configure env (see template below).
Environment Variables (example)
Note: some sandbox environments reject callback URLs containing the word mpesa in the path. If you see Invalid ValidationURL, use a different prefix such as payments.
Routes (under MPESA_ROUTE_PREFIX)
Response Format
All API responses return:
Generate Security Credential
Using the Config Service
The package exposes a typed config service so you don't need to call config('mpesa...') repeatedly.
MpesaClient and MpesaHelper are resolved from the container, so you can type-hint them and let Laravel inject:
Test Commands (examples)
Set:
STK Push
STK Query
B2C Send
B2C Validated
C2B Register URLs
C2B Simulate
C2B Validation (manual test)
C2B Confirmation (manual test)
Transaction Status
Transaction Status Result (callback test)
Transaction Status Timeout (callback test)
Account Balance
Account Balance Result (callback test)
Account Balance Timeout (callback test)
Reversal
Reversal Result (callback test)
Reversal Timeout (callback test)
Notes
- Requests and callbacks are persisted when
MPESA_STORE_REQUESTS=trueandMPESA_STORE_CALLBACKS=true. - Callbacks can be protected using
MPESA_WEBHOOK_VALIDATIONwith token/IP allow-listing. - Account balance is for the merchant organization’s short code or BuyGoods till, not an end-customer balance check.