tltc/momovn

There is no license information available for the latest version (1.0.3) of this package.

1.0.3 2019-07-18 16:21 UTC

This package is not auto-updated.

Last update: 2024-04-20 07:04:22 UTC


README

68747470733a2f2f646576656c6f706572732e6d6f6d6f2e766e2f696d616765732f6c6f676f2e706e67

About Tltc/Momovn

Momo is one of favourite payment gateway in Viet Name. This package will help developer to connect with it's API easily.

Install

composer require tltc/momovn

Required

"ixudra/curl": "^6.16"

Support

Laravel/ Lumen 5.7.*

Config

Public config file

php artisan vendor:publish --tag=config

Config value including

PARTNER_CODE: partner code of Momo Account
SECRET_KEY: Key using to generate signature
ACCESS_KEY: Key using to authen when call API
API_END_POINT: api route (/gw_payment/transactionProcessor)
DOMAIN: Momo url - change it to sandbox url in local/develop env

Use it

Add this line to provider list in config/app.php

\Tltc\Momovn\Providers\MomovnServiceProvider::class,

Example code

        $momoService = new MomovnService();
        $orderId = 'M'.rand(1, 20000);
        $amount = (string)rand(1000000, 2000000);
        $orderInfo = "Momo API testing";
        $requestId = 'M'.rand(1,200000);
        $returnUrl = route('home');
        $notifyUrl = route('home');
        $extraData = "merchantName=;merchantId=";
        $response = $momoService->requestMomoPayment($requestId, $amount, $orderId, $orderInfo, $returnUrl, $notifyUrl, $extraData);
        if ($response && !empty($response->payUrl)) {
            return redirect($response->payUrl); // Redirect to Momo payment
        } else {
            dd($response); // Check error code in Momo document
        }

Momo API document

Momo development site

License

This package is open-source software licensed under the MIT license.