Wallogit.com
2017 © Pedro Peláez
Tích hợp thanh toán thẻ cào qua Ngân Lượng cho website Laravel 5.2 tở lên.
Install with composer., (*2)
Install via composer, (*3)
composer require santran/mobicard:dev-master
Add Service Provider to config/app.php in providers section, (*4)
SanTran\MobiCard\MobiCardServiceProvider::class,
Add Facade to config/app.php in aliases section:, (*5)
'MobiCard' => SanTran\MobiCard\MobiCardFacade::class,
Publish config file, open console and enter bellow command:, (*6)
php artisan vendor:publish
Config file 'mobicard.php' will be copy to config/smartlogs.php, you can change any config on that file for MobiCard 'MERCHANT_ID' => "36680", 'MERCHANT_PASSWORD' => "matkhauketnoi", 'EMAIL_RECEIVE_MONEY' => "demo@nganluong.vn", (*7)
How to use ? Open your Controller. Add this line on above file, remember after 'namespace ...' keywork:, (*8)
use MobiCard;
on function, (*9)
$serial = $request->get('serial', "");
$pin = $request->get('pin', "");
$type = $request->get('select_method', "");
$arytype = array(92 => 'VMS', 93 => 'VNP', 107 => 'VIETTEL', 120 => 'GATE');
//Tiến hành kết nối thanh toán Thẻ cào.
$coin1 = rand(10, 999);
$coin2 = rand(0, 999);
$coin3 = rand(0, 999);
$coin4 = rand(0, 999);
$ref_code = $coin4 + $coin3 * 1000 + $coin2 * 1000000 + $coin1 * 100000000;
$rs = MobiCard::CardPay($pin, $serial, $type, $ref_code, "", "", "");
if ($rs->error_code == '00') {
// Cập nhật data tại đây
echo ''; //$total_results;
} else {
echo '';
}
on your views., (*10)
|
|
||||||||||
| Số Seri : | ||||||||||
| Mã số thẻ : | ||||||||||