stacks / mpesa
There is no license information available for the latest version (dev-master) of this package.
Mpesa Library
dev-master
2022-01-24 09:05 UTC
Requires
This package is auto-updated.
Last update: 2025-02-24 16:00:20 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');