stacks / mpesa
Mpesa Library
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/stacks/mpesa
Requires
This package is auto-updated.
Last update: 2025-09-24 17:29:35 UTC
README
https://stackbooks.org
Mpesa Library
Installation
composer require stacks/mpesa
Account setup and authentication `
<?php
use Stacks\Mpesa\Account;
$key='application-key';
$secret='application secret';
// authentication is handled automatically when the credentials are valid
$account = new Account($key,$secret);
`
Register Customer to Business Callbacks `
<?php
use Stacks\Mpesa\Account;
$key='application-key';
$secret='application secret';
$shortcode='pabill or till shortcode provided';
$confirm_url='https://example.com/confirm';
$validate_url='https://example.com/validate';
// authentication is handled automatically when the credentials are valid
$account = new Account($key,$secret,null,$shortcode);
// default command used is 'Completed'
$account->register($confirm_url,$validate_url);
//to override the default, i.e in cases where you need validation, pass a third parameter 'Cancelled/Completed'
$account->register($confirm_url,$validate_url,'Cancelled');