larslemos / mpesa-php-api

PHP library for M-Pesa API (Mozambique)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PHP library for M-Pesa API (Mozambique)

This library provides easy way to integrate PHP applications with the M-Pesa API.

NOTICE

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!

Installation

Install using composer:

composer require abdulmueid/mpesa

Usage

  1. Load the configuration from file.

    $config = \abdulmueid\mpesa\Config::loadFromFile('/path/to/config.php');
  2. Create a Transaction using the configuration.

    $transaction = new \abdulmueid\mpesa\Transaction($config);

    See sample configuration file in examples folder.

  3. Execute API operations and pass appropriate parameters.

    (See Class documentation in docs/ folder for parameter details.)

    1. Initiate a payment.

      $payment = $transaction->payment(...);
    2. Initiate a refund.

      $refund = $transaction->refund(...);
    3. Query a transaction.

      $query = $transaction->query(...);

License

This library is release under the MIT License. See LICENSE file for details.

TODO

  1. Improve documentation
  2. Add more examples
  3. Improve test suite and test automation

About

PHP library for M-Pesa API (Mozambique)

License:MIT License


Languages

Language:PHP 100.0%