uocnv/momo-payment

A pakage connect with momo

1.0.1 2022-01-13 02:02 UTC

This package is auto-updated.

Last update: 2022-09-13 03:41:47 UTC


README

Latest Version on Packagist Total Downloads

This is a package that helps connect to Momo service with All in one payment method.

Installation

You can install the package via composer:

composer require uocnv/momo-payment

Usage

  • Publish config:

    php artisan vendor:publish --provider="Uocnv\MomoPayment\MomoPaymentServiceProvider" --tag="config"
  • You can start with:

    $momoPayment = new MomoPayment(config('momo-payment.environment'));
  • Create a Capture request and receive response with redirect payment url:

    $response = $momoPayment->createRequest(array $data);
    $paymentUrl = $response->getPayUrl();

    More information in: Config Api

  • Processing payment results:

    You can check signature from response

    $response     = $momoPayment->checkResult($request->all());
    $errorCode    = $response->getErrorCode();
    $localMessage = $response->getLocalMessage();
    $transId      = $response->getTransId();
    $responseTime = $response->getResponseTime();
    $orderId      = $response->getOrderId();
    $orderInfo    = $response->getOrderInfo();
    $amount       = $response->getAmount();

    More information in: Processing payment results

  • Check transaction status:

    $response = $momoPayment->checkStatus($orderId, $requestId);
    $errorCode    = $response->getErrorCode();
    $localMessage = $response->getLocalMessage();
    $transId      = $response->getTransId();
    $orderId      = $response->getOrderId();
    $amount       = $response->getAmount();

    More information in: Check transaction status

Security

If you discover any security related issues, please email uocnv.soict.hust@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.