PHP code example of nhanchaukp / alepay

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

    

nhanchaukp / alepay example snippets


php artisan vendor:publish --tag=alepay-config

use Nhanchaukp\Alepay\Facades\Alepay;
...

public function alepayResult(Request $request)
{
    if ($request->errorCode == '000') {
        // success
        $info = Alepay::getTransactionInfo($request->transactionCode);
        dd($info);
    } else {
        // error
    }
}

use Nhanchaukp\Alepay\Facades\Alepay;
...

public function webhook(Request $request)
{
    return response()->json([
        'raw' => $request->all(),
        'verify' => Alepay::verifyTransaction($request->all())
    ]);
}