This library provides easy way to integrate PHP applications with the M-Pesa API.
Currently, this library is only usable if you are in the M-Pesa test group and have access to the API portal and credentials.
The M-Pesa API is quickly evolving. Therefore the code is currently for testing purposes only and will evolve with the M-Pesa API until it reaches a stable state.
DO NOT USE IN PRODUCTION!
Install using composer:
composer require abdulmueid/mpesa
-
Load the configuration from file.
$config = \abdulmueid\mpesa\Config::loadFromFile('/path/to/config.php');
-
Create a Transaction using the configuration.
$transaction = new \abdulmueid\mpesa\Transaction($config);
See sample configuration file in examples folder.
-
Execute API operations and pass appropriate parameters.
(See Class documentation in docs/ folder for parameter details.)
-
Initiate a payment.
$payment = $transaction->payment(...);
-
Initiate a refund.
$refund = $transaction->refund(...);
-
Query a transaction.
$query = $transaction->query(...);
-
This library is release under the MIT License. See LICENSE file for details.
- Improve documentation
- Add more examples
- Improve test suite and test automation