Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mpaannddreew/momo
Momo is a simple library in PHP for the MTN Mobile Money Open API.
https://github.com/mpaannddreew/momo
api mobilemoney mtn mtnmobilemoney mtnmomo openapi php
Last synced: 3 days ago
JSON representation
Momo is a simple library in PHP for the MTN Mobile Money Open API.
- Host: GitHub
- URL: https://github.com/mpaannddreew/momo
- Owner: mpaannddreew
- Created: 2019-04-20T20:18:58.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-07-28T15:06:50.000Z (over 2 years ago)
- Last Synced: 2025-01-10T05:37:25.312Z (about 1 month ago)
- Topics: api, mobilemoney, mtn, mtnmobilemoney, mtnmomo, openapi, php
- Language: PHP
- Size: 13.7 KB
- Stars: 12
- Watchers: 5
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## Momo
Momo is a simple library in PHP for the MTN Mobile Money Open API.
## Product support
* Collections
* Disbursements
* Remittances## Getting Started
* Signup For An Account
* Subscribe To Products## Signup For An Account
Follow this link to the developer portal and [signup](https://momodeveloper.mtn.com/signup.html)
for an account.## Subscribe To Products
On the [Products](https://momodeveloper.mtn.com/products.html) page on developer portal you should see items you can subscribe to:
* Collections
* Disbursements
* Remittances## Installation
The recommended way to install Momo is through [composer](http://getcomposer.org).
Just create a composer.json file for your project and require it:
```TERMINAL
composer require fannypack/momo
```
Now you can add the autoloader, and you will have access to the library:```php
'', //(optional) default is http://localhost:8000
// 'callbackUrl' => '', //(optional) default is http://localhost:8000/callback
// 'environment' => '', //(optional) default is sandbox
// 'accountHolderIdType' => '', //(optional) default is msisdn
'subscriptionKey' => '', //Product Subscription key
'xReferenceId' => '', //Api user reference id (in UUID format)
'apiKey' => '', // Api user key (Supply this after generating it at 'Create API Key')
//'preApproval' => '', //(optional) default is false
//'accessToken' => '' //Required for transactions
];// Using collection
$collection = Collection::create($options);// Using disbursement
$disbursement = Disbursement::create($options);// Using remittance
$remittance = Remittance::create($options);```
### Sandbox User Provisioning
#### Create API User
```php
createApiUser(); //{"statusCode": 201}```
#### GET API User Details
```php
getApiUser();
$apiUser->getProviderCallbackHost(); //http://localhost:8000
$apiUser->getTargetEnvironment(); //sandbox```
#### Create API Key
```php
createApiKey();
$apiKey->getApiKey(); //apiKey```
### Oauth 2.0
#### Get token
```php
getToken();
$token->getAccessToken(); //accessToken
$token->getTokenType(); //tokenType
$token->getExpiresIn(); //expiry in seconds```
### Transactions
#### Get account balance
```php
getAccountBalance();
$balance->getAvailableBalance(); //accountBalance
$balance->getCurrency(); //currency```
#### Get account holder status
```php
getAccountHolderInfo($accountHolderId); //{"statusCode": 201}```
### Collections
#### Request to pay
```php
requestToPay($externalId, $partyId, $amount, $currency, $payerMessage = '', $payeeNote = ''); // {"statusCode": 200, "financialTransactionId": "8f3077a6-ce43-4584-a425-589c50cfcbe4"}```
#### Request to pay status
```php
getRequestToPayStatus($financialTransactionId);
$transactionStatus->getAmount(); //amount
$transactionStatus->getCurrency(); //currency
$transactionStatus->getExternalId(); //externalId
$transactionStatus->getPayer(); //payer object
$transactionStatus->getStatus(); //status```
### Disbursements and Remittances
#### Transfer
```php
transfer($externalId, $partyId, $amount, $currency, $payerMessage = '', $payeeNote = '');// {"statusCode": 200, "financialTransactionId": "8f3077a6-ce43-4584-a425-589c50cfcbe4"}```
#### Transfer status
```php
transferStatus($financialTransactionId);
$transactionStatus->getAmount(); //amount
$transactionStatus->getCurrency(); //currency
$transactionStatus->getExternalId(); //externalId
$transactionStatus->getPayer(); //payer object
$transactionStatus->getStatus(); //status```
### Bugs
For any bugs found, please email me at [email protected] or register an issue at [issues](https://github.com/mpaannddreew/momo/issues)