?? md5_request.php
字號:
<html>
<title>CMDNO_1 財付通支付接口 PHP示例</title>
<meta http-equiv="Cache-Control" content="no-cache"/>
<body>
<?
/*這里替換為您的實際商戶號*/
$strSpid = "2000000301";
/*strSpkey是32位商戶密鑰, 請替換為您的實際密鑰*/
$strSpkey = "01234567890123456789012345678901";
/*財付通支付為"1" (當前只支持 cmdno=1)*/
$strCmdNo = "1";
/*交易日期 (yyyymmdd)*/
$strBillDate= date('Ymd');
/*銀行類型:
0 財付通
1001 招商銀行
1002 中國工商銀行
1003 中國建設銀行
1004 上海浦東發展銀行
1005 中國農業銀行
1006 中國民生銀行
1008 深圳發展銀行
1009 興業銀行 */
$strBankType= "0";
/*商品名稱*/
$strDesc = "騰訊超級公仔";
/*用戶QQ號碼, 現在置為空串*/
$strBuyerId = "";
/*商戶號*/
$strSaler = $strSpid;
/*商戶生成的訂單號(最多10位)*/
$strSpBillNo= "0000001002";
/*重要: 交易單號
交易單號(28位): 商戶號(10位) + 日期(8位) + 流水號(10位), 必須按此格式生成, 且不能重復
如果sp_billno超過10位, 則截取其中的流水號部分加到transaction_id后部(不足10位左補0)
如果sp_billno不足10位, 則左補0, 加到transaction_id后部*/
$strTransactionId = $strSpid . $strBillDate . $strSpBillNo;
/*總金額, 分為單位*/
$strTotalFee = "1";
/*貨幣類型: 1 – RMB(人民幣) 2 - USD(美元) 3 - HKD(港幣)*/
$strFeeType = "1";
/*財付通回調頁面地址, 推薦使用ip地址的方式(最長255個字符)*/
$strRetUrl = "http://www.yoursitename.com/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 ;
?>
<form action="https://www.tenpay.com/cgi-bin/v1.0/pay_gate.cgi" target=_blank>
<input type=hidden name="cmdno" value=<?echo $strCmdNo; ?>>
<input type=hidden name="date" value=<?echo $strBillDate; ?>>
<input type=hidden name="bank_type" value=<?echo $strBankType; ?>>
<input type=hidden name="desc" value=<?echo $strDesc; ?>>
<input type=hidden name="purchaser_id" value=<?echo $strBuyerId; ?>>
<input type=hidden name="bargainor_id" value=<?echo $strSaler; ?>>
<input type=hidden name="transaction_id" value=<?echo $strTransactionId; ?>>
<input type=hidden name="sp_billno" value=<?echo $strSpBillNo; ?>>
<input type=hidden name="total_fee" value=<?echo $strTotalFee; ?>>
<input type=hidden name="fee_type" value=<?echo $strFeeType; ?>>
<input type=hidden name="return_url" value=<?echo $strRetUrl; ?>>
<input type=hidden name="attach" value=<?echo $strAttach; ?>>
<input type=hidden name="sign" value=<?echo $strSign; ?>>
<h4>發送給財付通的請求串</h4>
<div>
<textarea name="textarea1" cols="100" rows="6" readonly="true">
<?
echo $strRequest;
?>
</textarea>
</div>
<input type=submit name=submit value=財付通支付>
</form>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -