?? config_pay_tenpay.php
字號:
<?php
//財付通 網上支付接口
/*這里替換為您的實際商戶號*/
$strSpid = $payment_userid[0];
/*strSpkey是32位商戶密鑰, 請替換為您的實際密鑰*/
$strSpkey = $payment_key[0];
/*銀行類型:
0 財付通
1001 招商銀行
1002 中國工商銀行
1003 中國建設銀行
1004 上海浦東發展銀行
1005 中國農業銀行
1006 中國民生銀行
1008 深圳發展銀行
1009 興業銀行 */
if(!isset($BankType)) $BankType = 0;
$BankType = ereg_replace("[^0-9]","",$BankType);
if($BankType < 1) $BankType = 0;
$strBankType= $BankType;
$strCmdNo = "1";
$strBillDate= date('Ymd');
/*商品名稱*/
if(!isset($pname)) $pname = '服務購買';
$strDesc = $pname;
/*用戶QQ號碼, 現在置為空串*/
$strBuyerId = "";
/*商戶號*/
$strSaler = $payment_userid[0];
//支付手續費
if($payment_exp[0] < 0) $payment_exp[0] = 0;
$piice_ex = $price*$payment_exp[0];
$price = $price+$piice_ex;
//支付金額
$strTotalFee = $price*100;
if( $strTotalFee < 1){
$dsql->Close();
exit('金額不對');
}
$strSpBillNo = $buyid;;
/*重要: 交易單號
交易單號(28位): 商戶號(10位) + 日期(8位) + 流水號(10位), 必須按此格式生成, 且不能重復
如果sp_billno超過10位, 則截取其中的流水號部分加到transaction_id后部(不足10位左補0)
如果sp_billno不足10位, 則左補0, 加到transaction_id后部*/
$strTransactionId = $strSpid . $strBillDate . time();
/*貨幣類型: 1 – RMB(人民幣) 2 - USD(美元) 3 - HKD(港幣)*/
$strFeeType = "1";
/*財付通回調頁面地址, 推薦使用ip地址的方式(最長255個字符)*/
$strRetUrl = $cfg_basehost."/member/paycenter/tenpay/notify_handler.php";
/*商戶私有數據, 請求回調頁面時原樣返回*/
$strAttach = "my_magic_string";
/*生成MD5簽名*/
$strSignText = "cmdno=" . $strCmdNo . "&date=" . $strBillDate . "&bargainor_id=" . $strSaler .
"&transaction_id=" . $strTransactionId . "&sp_billno=" . $strSpBillNo .
"&total_fee=" . $strTotalFee . "&fee_type=" . $strFeeType . "&return_url=" . $strRetUrl .
"&attach=" . $strAttach . "&key=" . $strSpkey;
$strSign = strtoupper(md5($strSignText));
/*請求支付串*/
$strRequest = "cmdno=" . $strCmdNo . "&date=" . $strBillDate . "&bargainor_id=" . $strSaler .
"&transaction_id=" . $strTransactionId . "&sp_billno=" . $strSpBillNo .
"&total_fee=" . $strTotalFee . "&fee_type=" . $strFeeType . "&return_url=" . $strRetUrl .
"&attach=" . $strAttach . "&bank_type=" . $strBankType . "&desc=" . $strDesc .
"&purchaser_id=" . $strBuyerId .
"&sign=" . $strSign ;
$strRequestUrl = "https://www.tenpay.com/cgi-bin/v1.0/pay_gate.cgi?".$strRequest;
if($cfg_soft_lang == 'utf-8')
{
$strRequestUrl = utf82gb($strRequestUrl);
echo '<html>
<head>
<title>轉到財付通支付頁面</title>
</head>
<body onload="document.tenpay.submit();">
<form name="tenpay" action="paycenter/tenpay/tenpay_gbk_page.php?strReUrl='.urlencode($strRequestUrl).'" method="post">
</form>
</body>
</html>';
}else{
echo '<html>
<head>
<title>轉到財付通支付頁面</title>
</head>
<body onload="document.tenpay.submit();">
<form name="tenpay" action="'.$strRequestUrl.'" method="post">
</form>
</body>
</html>';
}
exit;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -