PHP code example of asdh / imepay

1. Go to this page and download the library: Download asdh/imepay 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/ */

    

asdh / imepay example snippets


return [
    'merchant_number' => env('IME_PAY_MERCHANT_NUMBER'),
    'merchant_name' => env('IME_PAY_MERCHANT_NAME'),
    'merchant_code' => env('IME_PAY_MERCHANT_CODE'),
    'merchant_module' => env('IME_PAY_MERCHANT_MODULE'),
    'username' => env('IME_PAY_USERNAME'),
    'password' => env('IME_PAY_PASSWORD'),
    /**
     * The payment url
     *
     * E.g. https://stg.imepay.com.np:1234
     */
    'base_url' => env('IME_PAY_BASE_URL'),
];

use Asdh\ImePay\ImePay;

$imepay = new ImePay();

// refId can be any unique id or the order id through which you can get all the details of the order/product that the user is buying
$refId = Str::uuid();
$amount = 100;

$response = $imepay->getToken($refId, $amount);

$token = $response->tokenId();

$response->responseCode();
$response->responseDescription();
$response->refId();
$response->tokenId();
$response->amount();

$response->raw();

use Asdh\ImePay\ImePay;

$imepay = new ImePay();

$response = $imepay->verify($request->all());

if ($response->isVerified()) {
    // do your stuffs...
}

$response->responseCode();
$response->responseDescription();
$response->refId();
$response->msisdn(); // phone number of paying user
$response->tokenId();
$response->transactionId();

$response->raw();
bash
php artisan vendor:publish --provider="Asdh\ImePay\ImePayServiceProvider" --tag="imepay-config"