PHP code example of zarulizham / laravel-duitnow
1. Go to this page and download the library: Download zarulizham/laravel-duitnow 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/ */
zarulizham / laravel-duitnow example snippets
return [
'url' => env('DUITNOW_URL'),
'client_id' => env('DUITNOW_CLIENT_ID'),
'product_id' => env('DUITNOW_PRODUCT_ID'),
'client_secret' => env('DUITNOW_CLIENT_SECRET'),
'merchant_id' => env('DUITNOW_MERCHANT_ID'),
'x_signature_key' => env('DUITNOW_X_SIGNATURE_KEY'),
'token_expiry' => env('DUITNOW_TOKEN_EXPIRY', 3600),
'bank_cache' => env('DUITNOW_BANK_CACHE', 43200), # 12 hours
'merchant_name' => env('DUITNOW_MERCHANT_NAME'),
'account_type' => env('DUITNOW_MERCHANT_ACCOUNT_TYPE'),
'source_of_funds' => [
"01"
],
'certificates' => [
'uat' => [
'disk' => 'local',
'dir' => 'paynet/duitnow/',
],
'production' => [
'disk' => 'local',
'dir' => 'paynet/duitnow/',
]
],
'direct_path' => env('DUITNOW_DIRECT_PATH'),
'callback_path' => env('DUITNOW_CALLBACK_PATH'),
];
$duitNowPayment = new DuitNowPayment();
$bankInfo = explode('|', $request->bank);
$bankId = $bankInfo[0];
$bankType = $bankInfo[1];
$redirectUrl = $duitNowPayment->initiatePayment(10, "Zarul Zubir", $bankType, "Ref: " . rand(100, 200), $bankId, 'A1000001');
bash
php artisan vendor:publish --tag="duitnow-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="duitnow-config"
bash
php artisan vendor:publish --tag="duitnow-controller"
bash
php artisan vendor:publish --tag="duitnow-views"