PHPackages                             yves/mopay - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. yves/mopay

AbandonedArchivedLibrary[Payment Processing](/categories/payments)

yves/mopay
==========

This package provide easy way to make mobile money payments from mopay gateway

4.0.1(5y ago)290[2 PRs](https://github.com/yvesniyo/mopay/pulls)MITPHP

Since Jul 27Pushed 4y ago1 watchersCompare

[ Source](https://github.com/yvesniyo/mopay)[ Packagist](https://packagist.org/packages/yves/mopay)[ RSS](/packages/yves-mopay/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (4)DependenciesVersions (8)Used By (0)

Laravel 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
------------

[](#installation)

To get the latest version, simply require the project using [Composer](https://getcomposer.org).

```
$ composer require yves/mopay
```

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
--------------

[](#configurations)

Mopay requires connection configuration.

To get started, you'll need to publish all vendor assets:

```
$ php artisan mopay:install
```

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

[](#mopay_api_url)

This by default there is mopay api v1 [Ishema Api](http://api.ishema.rw/api/v1/debit).And it is where payment requests will pass through as gateway.

##### MOPAY\_API\_TOKEN

[](#mopay_api_token)

Make sure you set this for the token you get from [Ishema Web Dashboard](http://api.ishema.rw) dashboard on profile part.

##### MOPAY\_WEBHOOK

[](#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

[](#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

[](#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

[](#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

[](#configmopayphp)

```
return [
    "MOPAY_API_URL" => env("MOPAY_API_URL","http://api.ishema.rw/api/v1/debit"),
    "MOPAY_API_TOKEN" => env("MOPAY_API_TOKEN"),
    "MOPAY_WEBHOOK" => env("MOPAY_WEBHOOK",env("APP_URL")."/mopay/payments/webhook"),
    "APP_NAME_ON_EMAILS"=>  env("APP_NAME", "MOPAY RWANDA"),
    "MAIL_USERNAME"=> env("MAIL_USERNAME"),
    "USE_NEW_EMAIL_IN_CONTEXT_MODEL"=> env("USE_NEW_EMAIL_IN_CONTEXT_MODEL", false),
];
```

Initiate database table for payments
------------------------------------

[](#initiate-database-table-for-payments)

After installing publishables you need to migrate only one migrating of payments

```
$ php artisan migrate
```

Usage
-----

[](#usage)

This package can be used as a library.

### Example: using the library

[](#example-using-the-library)

#### Initialize model for payable

[](#initialize-model-for-payable)

if you wish to use it on your models just make sure that you have these columns:

1. `phone`.
2. `email` (OPTIONAL) only if you wish to send them emails.
3. `name` this will be taken as client name.

Include `Yves\Mopay\Traits\MopayTrait` trait in your model. like down below:

```
