?? notify_handler.php
字號:
<!-- #include file="asp_md5.asp" -->
<meta name="TENCENT_ONELINE_PAYMENT" content="China TENCENT">
<html>
<title>CMDNO_1 財付通支付響應(yīng) PHP示例</title>
<meta http-equiv="Cache-Control" content="no-cache"/>
<body>
<?
function ShowExitMsg($msg)
{
$strMsg = "<script language=javascript>\n";
$strMsg.= "window.location.href='http://www.yoursitename.com/showResult.php?msg=';
$strMsg.= $msg;
$strMsg.= "';\n";
$strMsg.= "</script></body></html>";
Exit($strMsg);
};
import_request_variables("gpc", "frm_");
/*取返回參數(shù)*/
$strCmdno = $frm_cmdno;
$strPayResult = $frm_pay_result;
$strPayInfo = $frm_pay_info;
$strBillDate = $frm_date;
$strBargainorId = $frm_bargainor_id;
$strTransactionId = $frm_transaction_id;
$strSpBillno = $frm_sp_billno;
$strTotalFee = $frm_total_fee;
$strFeeType = $frm_fee_type;
$strAttach = $frm_attach;
$strMd5Sign = $frm_sign;
/*本地參數(shù)*/
/*這里替換為您的實際商戶號*/
$strSpid = "2000000301";
/*strSpkey是32位商戶密鑰, 請?zhí)鎿Q為您的實際密鑰*/
$strSpkey = "01234567890123456789012345678901";
/*返回值定義*/
$iRetOK = 0; // 成功
$iInvalidSpid = 1; // 商戶號錯誤
$iInvalidSign = 2; // 簽名錯誤
$iTenpayErr = 3; // 財付通返回支付失敗
/*驗簽*/
$strResponseText = "cmdno=" . $strCmdno . "&pay_result=" . $strPayResult .
"&date=" . $strBillDate . "&transaction_id=" . $strTransactionId .
"&sp_billno=" . $strSpBillno . "&total_fee=" . $strTotalFee .
"&fee_type=" . $strFeeType . "&attach=" . $strAttach .
"&key=" . $strSpkey;
$strLocalSign = strtoupper(md5($strResponseText));
if( $strLocalSign != $strMd5Sign)
{
ShowExitMsg( "驗證MD5簽名失敗.");
}
if( $strSpid != $strBargainorId )
{
ShowExitMsg( "錯誤的商戶號.");
}
if( $strPayResult != "0" )
{
ShowExitMsg( "支付失敗.");
}
ShowExitMsg( "支付成功.");
?>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -