PHPackages                             nkaurelien/momopay - 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. nkaurelien/momopay

ActiveLibrary[Payment Processing](/categories/payments)

nkaurelien/momopay
==================

Paiement mobile avec mtn cameroun

72383PHP

Since Apr 3Pushed 2y ago2 watchersCompare

[ Source](https://github.com/nkaurelien/momopay)[ Packagist](https://packagist.org/packages/nkaurelien/momopay)[ RSS](/packages/nkaurelien-momopay/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

MOMOPAY
=======

[](#momopay)

[![Packagist License](https://camo.githubusercontent.com/0f8fcbab2a2a42ca226dfb826daa2ffb25ef6cfb4e3b6305130bdad19aa88ca2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6e6b617572656c69656e2f6d6f6d6f706179)](https://camo.githubusercontent.com/0f8fcbab2a2a42ca226dfb826daa2ffb25ef6cfb4e3b6305130bdad19aa88ca2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6e6b617572656c69656e2f6d6f6d6f706179)[![Packagist Version (including pre-releases)](https://camo.githubusercontent.com/95fc554e484c6d5c85ae1fb8181459c08e2e9d7aa25fea0bafab91e5525ec994/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6b617572656c69656e2f6d6f6d6f7061793f696e636c7564655f70726572656c6561736573)](https://camo.githubusercontent.com/95fc554e484c6d5c85ae1fb8181459c08e2e9d7aa25fea0bafab91e5525ec994/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6b617572656c69656e2f6d6f6d6f7061793f696e636c7564655f70726572656c6561736573)[![Packagist Downloads](https://camo.githubusercontent.com/7755910aac9e67345da129dbcf7787a0140dac9cda60f9c5c8adaa3b0350ddcc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6b617572656c69656e2f6d6f6d6f706179)](https://camo.githubusercontent.com/7755910aac9e67345da129dbcf7787a0140dac9cda60f9c5c8adaa3b0350ddcc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6b617572656c69656e2f6d6f6d6f706179)

Description
-----------

[](#description)

A package for mobile money payments in Cameroun.
 Only [Mtn Cameroon](https://mtn.cm/MoMo/) is supported

Installation
------------

[](#installation)

```
composer require nkaurelien/momopay

```

(optional) Add the service provider in `config\app.php`

```
    providers' => [
        #...
        \Nkaurelien\Momopay\Providers\MomopayServiceProvider::class,
    ]
```

(optional) Add the service facade in `config\app.php`

```
    aliases' => [
        #...
        'MomoPay' => \Nkaurelien\Momopay\Facades\MomoPay::class
    ]
```

Run publish

```
   php artisan vendor:publish
```

Run database migration

```
   php artisan migrate
```

Configuration
-------------

[](#configuration)

Add config to `config/services.php`

```

    'mtn' => [
        'currency' => env('MTN_MOMO_CURRENCY', 'XAF'),
        'go_live' => env('MTN_MOMO_GO_LIVE',false),
        'api_key' => env('MTN_MOMO_USER_API_KEY'),
        'reference_id' => env('MTN_MOMO_ID'),
        'subscription_key' => env('MTN_MOMO_KEY'),
        'payment_callback_route' => env('MTN_MOMO_CALLBACK_URL','payment.momo.callback'),
        'payment_callback_host' => env('MTN_MOMO_CALLBACK_HOST'),
        'notification_email' => env('MTN_MOMO_NOTIFICATION_EMAIL'),
    ],

```

Configuration description

- `reference_id` : is the user id
- `subscription_key` : is the Ocp-Apim-Subscription-Key
- `target_environment` : can be sanbox or mtncameroon (when you go live)

Don't forget to cache the configurations again with the command `php artisan config:cache`

Add routes
----------

[](#add-routes)

```
Route::any('/payment/momo/callback', 'PaymentMomoController@callback')->name('payment.momo.callback');
Route::get('/payment/momo/transaction/{id}', 'PaymentMomoController@getPayment')->name('payment.momo.gettransaction');
```

Use in controller
-----------------

[](#use-in-controller)

First inject the repository class

```
    private $paymentMomoRepository;
    public function __construct(PaymentMomoRepository $paymentMomoRepository){ #...
```

Then consume repository instance to implement your payment logic

```
    $momoRequestToPayDto = new \Nkaurelien\Momopay\Fluent\MomoRequestToPayDto;
    $momoRequestToPayDto->amount = 100;
    $momoRequestToPayDto->payeeNote = '';
    $momoRequestToPayDto->payerMessage = '';
    $momoRequestToPayDto->externalId = 'my_product_id';
    $momoRequestToPayDto->payer->telephone = '2376XXXXXXXX';

    # optional
    $momoRequestToPayDto->currency = 'XAF'; // Use EUR when you are in sandbox mode

    $refId = \Ramsey\Uuid\Uuid::uuid4()->toString();

    $requestToPayResult = $this->paymentMomoRepository->requestToPay($momoRequestToPayDto, $refId);
```

---

If you prefer the facade instead of injection then do:

```
    #...
    $requestToPayResult = \Nkaurelien\Momopay\Facades\MomoPay::requestToPay($momoRequestToPayDto, $refId);
```

Capture events
--------------

[](#capture-events)

You can listen to :

- **Nkaurelien\\Momopay\\Events\\PaymentFailed** is fired after a new verification
- **Nkaurelien\\Momopay\\Events\\PaymentSuccessful** is fired after a new verification
- **Nkaurelien\\Momopay\\Events\\PaymentAccepted** (pending) is fired after the success of request to pay or a new verification

Use commands
------------

[](#use-commands)

To verify transactions do

```
    php artisan momopay:verify-transactions # to verify all transactions
    php artisan momopay:verify-transactions [referenceId] # to verify a specific transaction
```

Todo
----

[](#todo)

- Create payment events
- Create payment exceptions class
- Create commands for scheduler and cron jobs
- Create transaction table for re-vefication
- Email notification on payment success
- Add orange money payment method

Useful links
------------

[](#useful-links)

- [MTN MoMo API](https://momodeveloper.mtn.com/)

Donate
======

[](#donate)

[![Buy Me A Coffee](https://camo.githubusercontent.com/9f44ce2dc3b3eecdd02598900866ffc518801df1932849703dae1e5ce5031070/68747470733a2f2f7777772e6275796d6561636f666665652e636f6d2f6173736574732f696d672f637573746f6d5f696d616765732f6f72616e67655f696d672e706e67)](https://www.paypal.com/donate/?hosted_button_id=FSXZJUZCHWG5N)

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity18

Early-stage or recently created project

 Bus Factor1

Top contributor holds 68.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6c42139d16fd0a145cbc9b60e33ff98344ceec8f27edf26dee5238d2b93d9f1a?d=identicon)[nkaurelien](/maintainers/nkaurelien)

---

Top Contributors

[![nkaurelien](https://avatars.githubusercontent.com/u/11745750?v=4)](https://github.com/nkaurelien "nkaurelien (24 commits)")[![Shlife](https://avatars.githubusercontent.com/u/51369384?v=4)](https://github.com/Shlife "Shlife (8 commits)")[![simo97](https://avatars.githubusercontent.com/u/14660547?v=4)](https://github.com/simo97 "simo97 (3 commits)")

### Embed Badge

![Health badge](/badges/nkaurelien-momopay/health.svg)

```
[![Health](https://phpackages.com/badges/nkaurelien-momopay/health.svg)](https://phpackages.com/packages/nkaurelien-momopay)
```

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
