📄 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 + -