PHP code example of howtomakeaturn / allpay-4-laravel
1. Go to this page and download the library: Download howtomakeaturn/allpay-4-laravel 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/ */
howtomakeaturn / allpay-4-laravel example snippets
'providers' => array(
// ...
'Howtomakeaturn\Allpay\AllpayServiceProvider',
)
'aliases' => array(
// ...
'Allpay' => 'Howtomakeaturn\Allpay\Facade\Allpay',
)
return array(
'ServiceURL' => "https://payment.allpay.com.tw/Cashier/AioCheckOut",
'HashKey' => "您的hashkey",
'HashIV' => "您的hashiv",
'MerchantID' => "您的merchantid"
);
$oPayment = new AllInOne();
/* 服務參數 */
$oPayment->ServiceURL ="<<您要呼叫的服務位址>>";
$oPayment->HashKey = "<<AllPay提供給您的Hash Key>>";
$oPayment->HashIV = "<<AllPay提供給您的Hash IV>>";
$oPayment->MerchantID ="<<AllPay提供給您的特店編號>>";
/* 基本參數 */
$oPayment->Send['ReturnURL'] = "<<您要收到付款完成通知的伺服器端網址>>";
$oPayment->Send['ClientBackURL'] = "<<您要歐付寶返回按鈕導向的瀏覽器端網址>>";
$oPayment->Send['OrderResultURL'] = "<<您要收到付款完成通知的瀏覽器端網址>>";
$oPayment->Send['ChoosePayment'] = PaymentMethod::ALL;
// blah blah
array_push($oPayment->Send['Items'], array('Name' => "<<產品C>>", 'Price' => (int)"<<單價>>",
'Currency' => "<<幣別>>", 'Quantity' => (int) "<<數量>>", 'URL' => "<<產品說明位址>>"));
/* 產生訂單 */
$oPayment->CheckOut();
Allpay::instance()->Send['ReturnURL'] = "<<您要收到付款完成通知的伺服器端網址>>";
Allpay::instance()->Send['ClientBackURL'] = "<<您要歐付寶返回按鈕導向的瀏覽器端網址>>";
Allpay::instance()->Send['OrderResultURL'] = "<<您要收到付款完成通知的瀏覽器端網址>>";
Allpay::instance()->Send['ChoosePayment'] = PaymentMethod::ALL;
// blah blah
array_push(Allpay::instance()->Send['Items'], array('Name' => "<<產品C>>", 'Price' => (int)"<<單價>>",
'Currency' => "<<幣別>>", 'Quantity' => (int) "<<數量>>", 'URL' => "<<產品說明位址>>"));
/* 產生訂單 */
Allpay::instance()->CheckOut();
app/config/app.php
app/config/app.php