This project aims to provide an easy-to-use and up-to-date PHP wrapper for the M-Pesa Mozambique API.
Target version of M-Pesa API: v1x
Install using composer:
composer require abdulmueid/mpesa:2.0.0-beta1
-
Load the configuration from file.
$config = \abdulmueid\mpesa\Config::loadFromFile('/path/to/config.php');
See sample configuration file in examples folder.
-
Create a Transaction using the configuration.
$transaction = new \abdulmueid\mpesa\Transaction($config);
-
Execute API operations and pass appropriate parameters.
-
Initiate a C2B payment collection.
$c2b = $transaction->c2b( float $amount, string $msisdn, string $reference, string $third_party_reference );
-
Initiate a B2C payment.
$b2c = $transaction->b2c( float $amount, string $msisdn, string $reference, string $third_party_reference );
-
Initiate a B2B payment.
$b2b = $transaction->b2b( float $amount, string $receiver_party_code, string $reference, string $third_party_reference );
-
Initiate a reversal.
$reversal = $transaction->reversal( float $amount, string $transaction_id, string $third_party_reference );
-
Query a transaction.
$query = $transaction->query( string $query_reference, string $third_party_reference );
-
This library is release under the MIT License. See LICENSE file for details.