coding-sniper / mpesa-c2b
A PHP package for easily implementing Mpesa(Daraja) C2B checkout API.
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/coding-sniper/mpesa-c2b
Requires
- php: >=5.3.0
This package is auto-updated.
Last update: 2025-12-23 15:21:35 UTC
README
This is a PHP package for easily implementing Mpesa(Daraja) C2B checkout API.
Features
- Initiate an STK push
- Check transaction status.
Installation
Inorder to install:
composer require coding-sniper/mpesa-c2b
Configuration
Fill in your credentials on the credentials.json file
{
"customer_key": "",
"callback" : "",
"customer_secret" : "",
"partyb" : "",
"shortcode" : "",
"pass_key" : "",
"country_code" : "",
"environment" : "live"
}
Usage
To perform an STK push:
use CodingSniper\MpesaC2B\MpesaC2B; $data = array("phone" => "","amount" => "","account_reference" => "", "trans_description" => ""); $mpesaC2B = new MpesaC2B(); $mpesaC2B->stkPush($data);
To check the transaction status:
use CodingSniper\MpesaC2B\MpesaC2B; $checkID = ""; // the check_id $mpesaC2B = new MpesaC2B(); $mpesaC2B->checkTrans($checkID);
License
MIT
Free Software, Hell Yeah!