Download the PHP package yves/mopay without Composer
On this page you can find all versions of the php package yves/mopay. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package mopay
Short Description This package provide easy way to make mobile money payments from mopay gateway
License MIT
Informations about the package mopay
Laravel Mopay
Package which can simplify developers work on their app which requires MTN Mobile Money payments in Rwanda, within the laravel application
Installation
To get the latest version, simply require the project using Composer.
Once installed, if you are not using automatic package discovery, then you need to register the Yves\Mopay\Providers\MopayServiceProvider
service provider in your config/app.php
.
Configurations
Mopay requires connection configuration.
To get started, you'll need to publish all vendor assets:
This will create a config\mopay.php
file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package between releases.
There are six config options:
MOPAY_API_URL
This by default there is mopay api v1 Ishema Api.And it is where payment requests will pass through as gateway.
MOPAY_API_TOKEN
Make sure you set this for the token you get from Ishema Web Dashboard dashboard on profile part.
MOPAY_WEBHOOK
This is the postback url or known as webhook for your project which will receive the result of the payments that you requested.
so put real url, by default there is http://app_url:port/mopay/payments/webhook"
.
MAIL_USERNAME
We did not forget those who wants to notify users view email for when there is status changes in their payments. To access it set your gmail or any email of your choosing here but also make sure that you configured mail, I mean like passwords and drivers of smtp. In development we used gmail and it did work great.
APP_NAME_ON_EMAILS
If you are using emails this values will be the one on emails as the sender.
USE_NEW_EMAIL_IN_CONTEXT_MODEL
Set this to true
if you want to send emails from updated state in your current model, or false
just to use the email that was used during the creation of payment.
default is false
config\mopay.php
Initiate database table for payments
After installing publishables you need to migrate only one migrating of payments
Usage
This package can be used as a library.
Example: using the library
Initialize model for payable
if you wish to use it on your models just make sure that you have these columns:
phone
.email
(OPTIONAL) only if you wish to send them emails.name
this will be taken as client name.
Include Yves\Mopay\Traits\MopayTrait
trait in your model. like down below:
Access model in controller and initiate payments
Actually this is straight forward cause you just only need to call your model and call pay function. like in this example we are going to initiate payment for 1,000Rwf in our controller for the passengers.
Note: Payments requires that you have queue worker or listener in background, so before you start call this command in project directory:
Or you could show web interface to your clients for payment
For now only phoneNumber
is capable of being changed on front view by