PHPackages                             akika/laravel-momo - 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. akika/laravel-momo

ActiveLibrary[Payment Processing](/categories/payments)

akika/laravel-momo
==================

An unofficial package for MTN MoMo

0.0.5(2mo ago)051[1 PRs](https://github.com/akikadigital/laravel-momo/pulls)MITPHPPHP ^8.1CI passing

Since Feb 22Pushed 1mo agoCompare

[ Source](https://github.com/akikadigital/laravel-momo)[ Packagist](https://packagist.org/packages/akika/laravel-momo)[ Docs](https://github.com/akika/laravel-momo)[ GitHub Sponsors]()[ RSS](/packages/akika-laravel-momo/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (26)Versions (7)Used By (0)

Laravel MTN MoMo
================

[](#laravel-mtn-momo)

[![Latest Version on Packagist](https://camo.githubusercontent.com/978441d6ec080cad5183335d94f05d20c2564b5cd7e863609e817d10d89df029/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616b696b612f6c61726176656c2d6d6f6d6f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/akika/laravel-momo)[![GitHub Tests Action Status](https://camo.githubusercontent.com/0e3d718a30f68f45f254e99725eb951361d7b54fbf70f4586129cbd291b15756/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616b696b616469676974616c2f6c61726176656c2d6d6f6d6f2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/akika/laravel-momo/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/8704f2e231c4df29b955784c3121e2eb8db40649df5ff5d7276aa3ccea1a4009/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616b696b616469676974616c2f6c61726176656c2d6d6f6d6f2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/akika/laravel-momo/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/3d2150d1b1ff19d241cc89d56b23455d61f25e1f656078feffa846ea3c2c6437/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616b696b612f6c61726176656c2d6d6f6d6f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/akika/laravel-momo)

An unofficial MTN MoMo integration for Laravel.

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

[](#installation)

Install via Composer:

```
composer require akika/laravel-momo
```

Optionally, publish the package config (and optional resources):

```
php artisan vendor:publish --tag="laravel-momo-config"
```

Configuration (.env)
--------------------

[](#configuration-env)

You will need:

- A secondary key which you can retrieve from your MoMo developer account.
- A valid UUID for the `USER_REFERENCE_ID` through a tool like  or via the cli:

```
uuidgen | tr '[:upper:]' '[:lower:]'`
```

Set environment variables below in your `.env`:

```
MOMO_ENV=sandbox
MOMO_TARGET_ENVIRONMENT=sandbox
MOMO_CALLBACK_HOST=example.com # this should be your domain without the https part or path
MOMO_DISBURSEMENT_CALLBACK_URL=https://example.com/api/callbacks/momo # this should match the path to your callback route
MOMO_SANDBOX_SECONDARY_KEY=your_secondary_key_here
MOMO_SANDBOX_USER_REFERENCE_ID=your_uuid_v4_here
MOMO_SANDBOX_API_KEY=your_api_key_here   # set after running the create-api-key command
MOMO_PRODUCTION_SECONDARY_KEY=your_secondary_key_here
MOMO_PRODUCTION_USER_REFERENCE_ID=your_uuid_v4_here
MOMO_PRODUCTION_API_KEY=your_api_key_here   # set after running the create-api-key command
```

> Note:
> When using `sandbox` mode, test using the Euro (EUR) currency, as that is the only currency that seems to work in sandbox mode.

For production, set:

- You can find all target environments [on this page.](https://momoapi.mtn.com/api-documentation/common-error)

```
MOMO_ENV=production
MOMO_TARGET_ENVIRONMENT=mtnghana
```

The full config file is at [config/momo.php](config/momo.php).

Creating an API User
--------------------

[](#creating-an-api-user)

You can create an API user using the provided Artisan command. The command will use the configured secondary key and user reference id from your config, or prompt for them.

Interactive (recommended):

```
php artisan momo:create-api-user
```

Non-interactive (useful for CI or scripts):

```
php artisan momo:create-api-user --no-confirmation --secondary-key=YOUR_SECONDARY_KEY --user-reference-id=YOUR_UUID_V4
```

After success, the API user will be registered with MTN, and you can retrieve it via `php artisan momo:get-api-user` (if available) or using the library API.

Creating an API Key
-------------------

[](#creating-an-api-key)

To create an API key for the registered API user run:

```
php artisan momo:create-api-key
```

The command prints the environment variable you should set (for example `MOMO_SANDBOX_API_KEY=...`). Add that value to your `.env` for the current environment.

You can also run non-interactively:

```
php artisan momo:create-api-key --no-confirmation --secondary-key=YOUR_SECONDARY_KEY --user-reference-id=YOUR_UUID_V4
```

Transferring Funds (Disbursement)
---------------------------------

[](#transferring-funds-disbursement)

Use the provided `MoMo` facade or the `MoMo` class directly to perform disbursements. The `disbursement()` product exposes `transfer()` and `getTransferStatus()`.

Example using the facade:

```
use Akika\\MoMo\\Facades\\MoMo;
use Akika\\MoMo\\Enums\\Currency;

// transfer 10.00 UGX to a payee MSISDN
$referenceId = MoMo::disbursement()->transfer(
	10.00,
	Currency::UgandaShilling,
	externalId: 'your-unique-external-id',
	payeeMsisdn: '25677XXXXXXX',
	payerMessage: 'Payment for invoice #123',
	payeeNote: 'Thanks',
);

// $referenceId is the transfer reference you can use to query status
```

The method returns a reference/transaction id (string). You may use any value you like for `externalId`, but using a UUID or unique invoice id is recommended.

Checking Transfer Status
------------------------

[](#checking-transfer-status)

Call `getTransferStatus()` with the reference id returned from `transfer()`:

```
$status = MoMo::disbursement()->getTransferStatus($referenceId);
```

`$status` is an array containing the provider response including the status and any metadata:

```
$status = [
    "amount" => "6.00",
    "currency" => "EUR",
    "financialTransactionId" => "554662921",
    "externalId" => "01KHXC2B1JQTKN16T8XHHTZX6A",
    "payee" => [
        "partyIdType" => "MSISDN",
        "partyId" => "0296631315"
    ],
    "payeeNote" => "Reprehenderit sequi fugiat ipsam sed.",
    "status" => "SUCCESSFUL"
];
```

Inspect the returned array for fields like `status`, `financialTransactionId`, etc.

Facade / Programmatic Usage
---------------------------

[](#facade--programmatic-usage)

You can instantiate `Akika\\MoMo\\MoMo` directly or use the provided facade `Akika\\MoMo\\Facades\\MoMo`.

Example using `Akika\\MoMo\\MoMo`:

```
use Akika\\MoMo\\MoMo;
use Akika\\MoMo\\Facades\\MoMo as MoMoFacade;

$client = new MoMo();
$client->createApiUser();
$apiKey = $client->createApiKey();
```

Example using `Akika\\MoMo\\Facades\\MoMo` facade:

```
use Akika\\MoMo\\Facades\\MoMo;

MoMo::createApiUser();
$apiKey = MoMo::createApiKey();
```

Checking the Account Balance
----------------------------

[](#checking-the-account-balance)

You can retrieve the MoMo account balance via the `Disbursement` product. The method returns an array with the available balance and currency.

Example using the `MoMo` facade:

```
use Akika\MoMo\Facades\MoMo;

$balance = MoMo::disbursement()->getAccountBalance();

// Example result:
// [
//   'availableBalance' => '123.45',
//   'currency' => 'EUR',
// ]
```

Example using the `MoMo` class directly:

```
use Akika\MoMo\MoMo;

$client = new MoMo();
$balance = $client->disbursement()->getAccountBalance();
```

Check the returned array for `availableBalance` and `currency` when handling the response.

Overriding configuration programmatically
-----------------------------------------

[](#overriding-configuration-programmatically)

You can override configuration values at runtime either by constructing a `MoMoConfig` and passing it to a product, or by using the `with()` helper on the `MoMo` facade to create a client with temporary overrides.

Example — instantiate `MoMoConfig` and pass it to the `Disbursement` product:

```
use Akika\MoMo\MoMo;

$client = new MoMo(
    'your_secondary_key',       // overrides momo..secondary_key
	'your_user_reference_id',   // overrides momo..user_reference_id
	'your_api_key',
    'your_target_environment'  // overrides momo.target_environment
)
$referenceId = $client->disbursement()->transfer(
	10.00,
	Currency::UgandaShilling,
	externalId: 'invoice-123',
	payeeMsisdn: '25677XXXXXXX',
);
```

Example — use the `with()` helper on the facade to create a client with overrides:

```
use Akika\\MoMo\\Facades\\MoMo;
use Akika\\MoMo\\Enums\\Currency;

$referenceId = MoMo::with(
	'your_secondary_key',
	'your_user_reference_id',
	'your_api_key',
    'your_target_environment'
)->disbursement()->transfer(
	10.00,
	Currency::UgandaShilling,
	externalId: 'invoice-123',
	payeeMsisdn: '25677XXXXXXX',
);
```

Callbacks
---------

[](#callbacks)

You can register an endpoint in your application to receive MoMo callbacks (for example, transfer/disbursement notifications). Add the route to `routes/api.php` or `routes/web.php` depending on whether you want it under the `api` middleware group.

Example route (add to `routes/api.php`):

```
use Illuminate\Http\Request;

Route::post('/callbacks/momo', function (Request $request) {
	$data = $request->all();

	info(__METHOD__, compact('data'));

	return response()->json(['message' => 'success']);
});
```

Notes:

- Ensure your `MOMO_DISBURSMENT_CALLBACK_URL` is set in your `.env` and reachable by MTN (use a public HTTPS URL in production; tools like `ngrok` can help during local development).
- Consider validating incoming requests (signatures, known headers or a shared secret) before trusting the payload in production.

Sample callback payload for a disbursement:

```
{
    "amount": "6.00",
    "currency": "EUR",
    "financialTransactionId": "554662921",
    "externalId": "01KHXC2B1JQTKN16T8XHHTZX6A",
    "payee": {
        "partyIdType": "MSISDN",
        "partyId": "0296631315"
    },
    "payeeNote": "Reprehenderit sequi fugiat ipsam sed.",
    "status": "SUCCESSFUL"
}
```

The route above logs the callback payload with Laravel's `info()` helper and responds with a JSON success message. Adjust handling according to your application's needs (update transfer status, notify users, etc.).

Tests
-----

[](#tests)

Run tests with:

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Akika Digital](https://github.com/akika)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). See [LICENSE.md](LICENSE.md).

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance88

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 87.2% 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.

###  Release Activity

Cadence

Every ~3 days

Total

5

Last Release

68d ago

PHP version history (2 changes)v0.0.1PHP ^8.3

v0.0.2PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/3b9d9e3a6ef73a3692c261d49a7a70d0362c5e83fa9a4e8765eb9309173b59b3?d=identicon)[akika.digital](/maintainers/akika.digital)

---

Top Contributors

[![karanimwenda](https://avatars.githubusercontent.com/u/29086814?v=4)](https://github.com/karanimwenda "karanimwenda (41 commits)")[![fenicfelix](https://avatars.githubusercontent.com/u/7171039?v=4)](https://github.com/fenicfelix "fenicfelix (6 commits)")

---

Tags

laravelAkika Digitallaravel-momo

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/akika-laravel-momo/health.svg)

```
[![Health](https://phpackages.com/badges/akika-laravel-momo/health.svg)](https://phpackages.com/packages/akika-laravel-momo)
```

###  Alternatives

[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[danestves/laravel-polar

A package to easily integrate your Laravel application with Polar.sh

7812.3k](/packages/danestves-laravel-polar)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)[creagia/laravel-redsys

Laravel Redsys Payments Gateway

2013.6k](/packages/creagia-laravel-redsys)

PHPackages © 2026

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