$item_name = "遊戲寶全家立即儲100元(測試)"; //交易返回頁面 $return_url = "http://www.allpay.com.tw/receive.php"; //交易通知網址 $client_back_url = "http://www.allpay.com.tw/receive.php"; //選擇預設付款方式 $choose_payment = "APPBARCODE"; //是否需要額外的付款資訊 $needExtraPaidInfo = "N"; /***************以下為測試環境資訊(若轉換為正式環境,請修改以下參數值)**********************/ //交易網址(測試環境) $gateway_url = "http://payment-stage.allpay.com.tw/Cashier/AioCheckOut"; //商店代號 $merchant_id = "2000132"; //HashKey $hash_key = "5294y06JbISpM5x9"; //HashIV $hash_iv = "v77hoKGq4kWxNNIS"; /********************************************************************************************/ $form_array = array("MerchantID" => $merchant_id, "MerchantTradeNo" => $trade_no, "MerchantTradeDate" => date("Y/m/d H:i:s"), "PaymentType" => "aio", "TotalAmount" => $total_amt, "TradeDesc" => $trade_desc, "ItemName" => $item_name, "ReturnURL" => $return_url, "ChoosePayment" => $choose_payment, "ClientBackURL" => $client_back_url, "NeedExtraPaidInfo" => $needExtraPaidInfo); # 調整ksort排序規則--依自然排序法(大小寫不敏感) ksort($form_array, SORT_NATURAL | SORT_FLAG_CASE); # 取得 Mac Value $form_array['CheckMacValue'] = _getMacValue($hash_key, $hash_iv, $form_array); $html_code = '<form target="_blank" method=post action="' . $gateway_url . '">'; foreach ($form_array as $key => $val) { $html_code .= "<input type='text' name='" . $key . "' value='" . $val . "'><BR>"; } $html_code .= "<input class='button04' type='submit' value='送出'>"; $html_code .= "</form>"; echo $html_code;
ob_start(); //打開快取 echo "data<br>"; print_r($data); echo 'POST LIST'; echo "<pre>"; print_r($_POST); echo "</pre>"; */ //判斷交易狀態 -- 回傳成功,但結果有可能遭竄改,因此需和編碼內 if ($_POST['RtnCode'] == "1" && $_POST['CheckMacValue']) { //調整ksort排序規則--依自然排序法(大小寫不敏感) ksort($data, SORT_NATURAL | SORT_FLAG_CASE); //取得 Mac Value echo 'CHKCODE='; echo $chkstr = _getMacValue($hash_key, $hash_iv, $data); echo '<br>'; //比較安全碼 if (strtoupper($chkstr) == $_POST['CheckMacValue']) { $shopping_car->paycheck($_POST['MerchantTradeNo']); echo '1|OK'; } else { echo '0|ErrorMessage'; } } else { echo '0|ErrorMessage'; } /* $info=ob_get_contents(); //得到緩衝區的內容並且賦值給$info $file=fopen('output.html','w'); //打開文件info.txt fwrite($file,$info); //寫入信息到info.txt