PHPackages                             gemfourmedia/omnipay-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. gemfourmedia/omnipay-momo

ActiveLibrary[Payment Processing](/categories/payments)

gemfourmedia/omnipay-momo
=========================

MoMo payment gateway driver for Omnipay library

v1.0.0(3y ago)012MITPHPPHP ^7.1|^8.0

Since Feb 5Pushed 3y ago1 watchersCompare

[ Source](https://github.com/gemfourmedia/omnipay-momo)[ Packagist](https://packagist.org/packages/gemfourmedia/omnipay-momo)[ Docs](https://github.com/gemfourmedia/omnipay-momo)[ RSS](/packages/gemfourmedia-omnipay-momo/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

Info
----

[](#info)

Momo payment driver for [Omnipay League](https://github.com/thephpleague/omnipay).

Introduce about **Omnipay** gateways, read [here](https://omnipay.thephpleague.com/)for reference

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

[](#installation)

Via [Composer](https://getcomposer.org):

```
composer require gemfourmedia/omnipay-momo
```

Usage
-----

[](#usage)

### Initialize

[](#initialize)

Please read MoMo documentation [here](https://developers.momo.vn/v3/vi/docs/payment/onboarding/overall)

```
use Omnipay\Omnipay;

$gateway = Omnipay::create('MoMo');
$gateway->initialize([
    'accessKey' => 'Provided by MoMo',
    'partnerCode' => 'Provided by MoMo',
    'secretKey' => 'Provided by MoMo',
]);
```

### Purchase Request:

[](#purchase-request)

```
$response = $gateway->purchase([
    'amount' => 20000,
    'redirectUrl' => 'https://yourdomain.com/payment-success',
    'ipnUrl' => 'https://yourdomain.com/ipn',
    'orderId' => 'unique id', // eg: 9
    'requestType' => 'captureWallet', // captureWallet|payWithATM|payWithCC
    'lang' => 'vi', // vi|en
    'orderInfo' => '',
    'requestId' => (string) \Str::uuid(), // eg: da584fe0-0fe3-47c6-ad20-19ad3e050140
    'extraData' => base64_encode(json_encode([])),
])->send();

if ($response->isRedirect()) {
    $redirectUrl = $response->getRedirectUrl();

    // TODO: Redirect to MoMo Payment page
}
```

For more parameters, read [here](https://developers.momo.vn/v3/docs/payment/api/wallet/onetime#api-configuration).

### Complete Purchase (handle respone data when MoMo redirect back to your site):

[](#complete-purchase-handle-respone-data-when-momo-redirect-back-to-your-site)

```
$response = $gateway->completePurchase()->send();

if ($response->isSuccessful()) {
    print $response->amount;
    print $response->orderId;

    var_dump($response->getData());

} else {

    print $response->getMessage();
}
```

For more parameters, read [here](https://developers.momo.vn/v3/docs/payment/api/wallet/onetime#processing-payment-result).

### MoMo IPN (Instant Payment Notification) handler:

[](#momo-ipn-instant-payment-notification-handler)

```
$response = $gateway->notification()->send();

if ($response->isSuccessful()) {

    print $response->amount;
    print $response->orderId;

    // Get all MoMo respone data.
    var_dump($response->getData());

} else {

    print $response->getMessage();
}
```

For more respone parameters, read [here](https://developers.momo.vn/v3/docs/payment/api/result-handling/notification/).

### Query Transaction (Check Transaction Status):

[](#query-transaction-check-transaction-status)

```
$response = $gateway->queryTransaction([
    'orderId' => '9',
    'requestId' => 'da584fe0-0fe3-47c6-ad20-19ad3e050140',
    'lang' => 'vi',
])->send();

if ($response->isSuccessful()) {
    // TODO: handle result.
    print $response->amount;
    print $response->orderId;

    var_dump($response->getData()); // All momo response data

} else {

    print $response->getMessage();
}
```

For more parameters, read [here](https://developers.momo.vn/v3/vi/docs/payment/api/payment-api/query).

### Refund:

[](#refund)

```
$response = $gateway->refund([
    'orderId' => 'refund-10', //Note: orderId (new) of the refund transaction which must be different from orderId of the original purchase transaction
    'requestId' => '1f60e60a-a78c-45c0-b6da-94d1855157ae',
    'amount' => 2100,
    'transId' => 2842402931,
    'lang' => 'vi',
    'description' => 'Example refund 10',
])->send();

if ($response->isSuccessful()) {
    var_dump($response->getData());

} else {

    print $response->getMessage();
}
```

For more respone parameters, read [here](https://developers.momo.vn/v3/docs/payment/api/payment-api/refund/#http-request).

### Query Refund Status:

[](#query-refund-status)

```
$response = $gateway->queryRefund([
    'orderId' => 'refund-10',
    'requestId' => '1f60e60a-a78c-45c0-b6da-94d1855157ae',
    'lang' => 'vi',
])->send();

if ($response->isSuccessful()) {

    var_dump($response->getData());

} else {

    print $response->getMessage();
}
```

For more respone parameters, read [here](https://developers.momo.vn/v3/docs/payment/api/payment-api/refund/#http-response-1).

### Debug:

[](#debug)

```
    print $response->getCode(); // Get result code from MoMo.
    print $response->getMessage(); // Get message .
```

Result code reference `getCode()` read [here](https://developers.momo.vn/v3/docs/payment/api/result-handling/resultcode).

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

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

Unknown

Total

1

Last Release

1193d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e1444aa14373e6766dfef7b2d081bdf7e8753216020724c1c1a83efa43386881?d=identicon)[gemfourmedia](/maintainers/gemfourmedia)

---

Top Contributors

[![gemfourmedia](https://avatars.githubusercontent.com/u/70109217?v=4)](https://github.com/gemfourmedia "gemfourmedia (1 commits)")

---

Tags

paymentpayment gatewaymomovietnam-paymentvietnam-payment-gatewaygemfourmedia

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gemfourmedia-omnipay-momo/health.svg)

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

###  Alternatives

[phpviet/omnipay-momo

Thư viện hổ trợ tích hợp cổng thanh toán MoMo.

318.3k2](/packages/phpviet-omnipay-momo)[shetabit/payment

Laravel Payment Gateway Integration Package

944330.1k5](/packages/shetabit-payment)[phpviet/omnipay-vnpay

Thư viện hổ trợ tích hợp cổng thanh toán VNPay.

178.2k2](/packages/phpviet-omnipay-vnpay)[shetabit/multipay

PHP Payment Gateway Integration Package

291348.2k3](/packages/shetabit-multipay)[cybersource/rest-client-php

Client SDK for CyberSource REST APIs

39881.3k6](/packages/cybersource-rest-client-php)[tzsk/payu

PayU India Payment Gateway Integration with Laravel

47108.8k6](/packages/tzsk-payu)

PHPackages © 2026

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