Download the PHP package patricpoba/mtn-momo-api-php without Composer

On this page you can find all versions of the php package patricpoba/mtn-momo-api-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mtn-momo-api-php

MTN MoMo API

Latest Version on Packagist GitHub license Build Status Quality Score Total Downloads

This package helps you integrate the MTN MOMO API into your Php or Laravel application. Its wrapper around the MTN Open API to provide you with a much simpler API to work with.

Installation

You are required to have PHP 7.0 or later. You can install the package via composer:

Usage

In production, the needed credentials are provided for you on the MTN OVA management dashboard after KYC requirements are met. But in a testing environment, a sanbox user would have to be created by you using the API, which this package can do for you.

Creating a sandbox environment API user

We need to get the User ID and User Secret and to do this we shall need to use the Primary Key for the Product to which we are subscribed, as well as specify a host. The library ships with a commandline application that helps to create sandbox credentials. It assumes you have created an account on https://momodeveloper.mtn.com and have your Ocp-Apim-Subscription-Key (primaryKey) located at https://momodeveloper.mtn.com/developer.

The option c is your callback host and the option k is the primary key or Ocp-Apim-Subscription-Key for the specific product to which you are subscribed. The API Key is unique to the product and you will need an API Key for each product you use. You should get a response similar to the following:

Configuration

We have to setup up the package to utilise the our momodeveloper credentials by creating an instance of the MtnConfig and pass it to the constructor of the class of the product (collection, disbursement or remittance) we want to use as demonstrated below. The configuration can be overriden a product instance by calling the ->setConfig($config) method and passing the new config instance.

Collection

Collections is used for requesting a payment from a customer (Payer) and checking status of transactions. Read more on Momo Collection

Collection Methods

  1. requestToPay: This operation is used to request a payment from a consumer (Payer). The payer will be asked to authorize the payment. The transaction is executed once the payer has authorized the payment. The transaction will be in status PENDING until it is authorized or declined by the payer or it is timed out by the system. Status of the transaction can be validated by checking the status field on the result of getTransaction() method.

  2. getTransaction: Retrieve transaction information using the transactionId returned by requestToPay. You can invoke it at intervals until the transaction fails or succeeds.

  3. getBalance: Get the balance of the account.

  4. accountHolderActive: check if an account holder is registered and active in the system.

Disbursement

Disbursement is used for transferring money from the provider account to a customer. Read more on Momo Disbursement

Disbursement Methods

  1. transfer: This operation is used to request a payment from a consumer (Payer). The payer will be asked to authorize the payment. The transaction is executed once the payer has authorized the payment. The transaction will be in status PENDING until it is authorized or declined by the payer or it is timed out by the system. Status of the transaction can be validated by checking the status field on the result of getTransaction() method.

  2. getTransaction: Retrieve transaction information using the transactionId returned by requestToPay. You can invoke it at intervals until the transaction fails or succeeds.

  3. getBalance: Get the balance of your disbursement account.

  4. accountHolderActive: check if an account holder is registered and active in the system.

Remittance

Transfer operation is used to transfer an amount from the own account to a payee account.

Api Responses

All api calls return the PatricPoba\MtnMomo\Http\ApiResponse object which is described below:

Testing

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of mtn-momo-api-php with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0|^8.0
guzzlehttp/guzzle Version ^6.5|^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package patricpoba/mtn-momo-api-php contains the following files

Loading the files please wait ....