Download the PHP package foris-master/mtn-mobile-money-sdk without Composer
On this page you can find all versions of the php package foris-master/mtn-mobile-money-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download foris-master/mtn-mobile-money-sdk
More information about foris-master/mtn-mobile-money-sdk
Files in foris-master/mtn-mobile-money-sdk
Package mtn-mobile-money-sdk
Short Description This is a php sdk for MTN operator mobile money api.
License MIT
Homepage https://github.com/php-loep/:package_name
Informations about the package mtn-mobile-money-sdk
mtn-mobile-money-sdk
php sdk for MTN MNO Mobile Money API
Note: mtn-mobile-money-sdk
.
This is a php sdk for mtn operator mobile money api.
Install
Via Composer
Global Config
-
MOMO_CURRENCY
Setup the currencyvalue
: EUR MOMO_SDK_ENV
Configures the value of the SDK environmentvalue
: sandbox or prodMOMO_ENV
variable to specify the application environmentvalue
: mtncameroon-
MOMO_CALLBACK_HOST
Sets the callback host for MTN API notificationsvalue
:https://example.com MOMO_CALLBACK_URL
URL of the callback for MTN API notificationsvalue
: https://myawesome.callback.com- enviroment variable ( .env file if using dotenv)
Quick Usage
Config Disbursement
Disbursement is used for transferring money from the provider account to a customer Read more about Momo Disbursement.
MOMO_DISBURSEMENT_PRIMARY_KEY
Primary Key for the Disbursement product on the developer portalvalue
: your primary key hereMOMO_DISBURSEMENT_API_USER
User for the Disbursement APIvalue
: Your appuserMOMO_DISBURSEMENT_APP_KEY
application key for the Disbursement productvalue
: your app key
Disbursement Usage
- Get token
getAccessToken()
This method allows you to obtain an access token to perform disbursement operations.
- transfer
transfer($amount, $tel, $options = array())
This method allows you to perform a funds transfer.
- getTransaction
getTransaction('transaction_id')
This method allows you to retrieve the details of a disbursement transaction.
- getBalance
getBalance()
This method allows you to get the balance of the disbursement account.
- isAccountValid
isAccountValid('0123456789')
This method allows you to check if a phone number is associated with a valid account.
Config Collection
Collections is used for requesting a payment from a customer and checking status of transactions Read more about Momo Collection.
MOMO_COLLECTION_PRIMARY_KEY
Primary Key for the Collection product on the developer portalvalue
: your primary key hereMOMO_COLLECTION_API_USER
User for the Collection APIvalue
: Your appuserMOMO_COLLECTION_APP_KEY
application key for the Collection productvalue
: your app key
Collection Usage
Collections is used for requesting a payment from a customer and checking status of transactions.
- Get token
getAccessToken()
This method allows you to obtain an access token to perform collection operations.
- requestToPay
requestToPay(100, '0123456789')
This method Initiates a payment request for a specific amount to the given phone number
- getTransaction
getTransaction($id)
This method allows you to retrieve the details of a transaction.
-
getBalance
getBalance()
Retrieves the balance of the collection account - isAccountValid
isAccountValid()
Checks if the given phone number is associated with a valid collection account
Note
The status could take one of the following values: INITIATED; PENDING; EXPIRED; SUCCESS; FAILED
- INITIATED waiting for user entry
- PENDING user has clicked on “Confirmer”, transaction is in progress on Mtn side
- EXPIRED user has clicked on “Confirmer” too late (after token’s validity)
- SUCCESS payment is done
- FAILED payment has failed
Production
Testing
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.