PHP code example of uocnv / momo-payment

1. Go to this page and download the library: Download uocnv/momo-payment library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

uocnv / momo-payment example snippets


    php artisan vendor:publish --provider="Uocnv\MomoPayment\MomoPaymentServiceProvider" --tag="config"
    

    $momoPayment = new MomoPayment(config('momo-payment.environment'));
    

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

    $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();
    

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