⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 payreceive.jsp

📁 payment.htm:支付提交页面。主要用于测试提交支付。内附详细说明。 payment.jsp:订单生成程序。内附详细说明和表单提交内容制作程序。 payreceive.jsp:订单支付成功返
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" errorPage="errorpage.jsp"%>
<%@ page import="java.util.*"%>
<%@ page import="java.text.*"%>
<jsp:useBean id='oMD5' scope='request' class='beartool.MD5'/>
<%
//特别提示:本程序未在JSP环境进行测试,如有问题,请及时反馈给我们,谢谢!
//#############################################################
//#               贺喜支付平台支付接口接收程序
//#                          v2.3jsp
//#                   http://www.168reg.cn
//#
//#  版权所有: 株洲市和谐网络科技发展有限公司
//#
//#  主页地址: http://www.168reg.cn
//#  技术支持: support@168reg.cn
//#  技 术 QQ: 359465724
//#  技术QQ群:8246422,7048987
//#
//#############################################################
//# ·郑重声明:
//# ·此程序不得随意公开发布、销售或进行其他非法转让。
//# ·如对此程序有任何疑问,请在管理区留言。
//#############################################################

//本文件功能介绍:
//1、根据自己的密钥设置验证返回的加密字符串是否正确。
//2、显示定单成功页面(可自行进行美化)。
//3、如果返回的提交有错误,即显示错误信息。
//4、为了增强反馈定单的安全性,系统返回的加密字符串由“支付平台定单号+商户订单号+自定义字段1+自定义字段2+成功支付金额+支付方式编号+商户编号+定单支付状态+商户密钥+支付模式”经过MD5加密后产生的。下面的程序已经完成了此加密字符串的验证。
//5、为了防止黑客通过不正常的手段恶意反馈(刷新)成功页面,请您在此程序中加入验证定单号的功能,即每一个成功定单只能反馈一次此页面。
//6、反馈的数据您都可以充分利用并添加到您自己的数据库中。

//初始化定义参数
//商户编号,请把您的商户编号替换掉这里的0值。
String reg_userid="0";
//商户密钥,请把您的商户密钥替换掉这里的空值。
String reg_key="";
//您可以充分利用以下反馈信息并添加到您自己的数据库中。
String v_orderid=new String(request.getParameter("v_orderid").getBytes("iso-8859-1"));   //贺喜支付平台反馈的定单号
String v_orderdate=new String(request.getParameter("v_orderdate").getBytes("iso-8859-1"));   //定单成交时间
String v_price=new String(request.getParameter("v_price").getBytes("iso-8859-1"));   //定单成交价格,以分为单位
String v_billno=new String(request.getParameter("v_billno").getBytes("iso-8859-1"));   //商户订单号
String v_custom1=new String(request.getParameter("v_custom1").getBytes("iso-8859-1"));   //自定义字段1
String v_custom2=new String(request.getParameter("v_custom2").getBytes("iso-8859-1"));   //自定义字段2
String v_mobileno=new String(request.getParameter("v_mobileno").getBytes("iso-8859-1"));   //用户支付的手机号码,仅手机短信注册时有效
String v_servicename=new String(request.getParameter("v_servicename").getBytes("iso-8859-1"));   //支付订单的服务名称
String v_payvia=new String(request.getParameter("v_payvia").getBytes("iso-8859-1"));   //用户选择的支付途径,1:银行卡在线支付;2:声讯电话支付;3:互联星空支付;4:手机短信注册;5:腾讯财付通支付;6:腾讯Q币支付;7:神州行充值卡支付;8,盛大游戏点卡支付;9,支付宝支付;10,手机银行支付;11,北京宽带支付;12,联通充值卡支付
String v_payviastr=new String(request.getParameter("v_payviastr").getBytes("iso-8859-1"));   //用户选择的支付途径中文名称
String v_md5=new String(request.getParameter("v_md5").getBytes("iso-8859-1"));   //返回的加密字符串
String v_pstatus=new String(request.getParameter("v_pstatus").getBytes("iso-8859-1"));   //定单成功反馈的字符串,有1和0两种情况。主要用于验证是否属正常反馈。1为成功。
String v_pstring=new String(request.getParameter("v_pstring").getBytes("iso-8859-1"));   //定单支付状态说明。
String v_paymode=new String(request.getParameter("v_paymode").getBytes("iso-8859-1"));   //当前定单运行模式,仅启用测试模式时有效,值为testmode。

//-----------重新计算md5的值,验证返回的数字签名是否正确------------------------------------------------

if(v_pstatus.equals("1")){
	String text = v_orderid+v_billno+v_custom1+v_custom2+v_price+v_payvia+reg_userid+v_pstatus+reg_key+v_paymode;		//为正确数值串拼凑顺序
	digestString = oMD5.getMD5ofStr(text);  //计算MD5的值
	if (digestString.equals(v_md5)){
	
//建议在此对定单号和支付金额进行验证以防止用户刷新返回页面多次获得服务。
//下面请放入定单成功页面的HTML代码
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>贺喜多途径支付平台支付返回页面</title>
<STYLE type="text/CSS">
Body {text-Align:Center;Font-Size:9pt}
TD {Font-Size:9pt}
input {font-size:9pt}
.style3 {	COLOR: #000000
}
</STYLE>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
</head>

<body>
<div align="center">
  <center>
  <map name="MapMapMapMap2">
    <area shape="rect" coords="3,36,73,54" href="#" onClick="MM_openBrWindow('http://www.168reg.cn/','','scrollbars=yes')">
    <area shape="rect" coords="76,36,140,54" href="#" onClick="MM_openBrWindow('http://www.168reg.com/help.asp','','scrollbars=yes')">
  </map>  
  <TABLE height=400 cellSpacing=1 cellPadding=0 width=370 align=center 
bgColor=#666666 border=0>
    <TBODY>
      <TR bgColor=#f7fef1>
        <TD width="100%" bgColor=#ffffff><TABLE height=400 cellSpacing=0 cellPadding=0 width=570 border=0>
            <TBODY>
              <TR>
                <TD vAlign=top height=63><TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
                    <TBODY>
                      <TR>
                        <TD valign="top"><table width="101%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td width="15%"><a href="http://www.168reg.cn" target="_blank"><img src="images/logo.gif" width="173" height="62" border="0"></a></td>
                            <td width="71%">&nbsp;</td>
                            <td width="14%"><img src="images/top_right.gif" width="148" height="62" usemap="#MapMapMapMap2" border="0">
                            </td>
                          </tr>
                          <tr bgcolor="#666666">
                            <td colspan="3" height="2"></td>
                          </tr>
                        </table></TD>
                        </TR>
                      <TR bgColor=#666666>
                        <TD height=1 valign="top"></TD>
                      </TR>
                    </TBODY>
                </TABLE></TD>
              </TR>
              <TR>
                <TD vAlign=top height=337><TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
                    <TBODY>
                      <TR>
                        <TD background=images/bg.gif height=312><TABLE height=301 cellSpacing=3 cellPadding=3 width=557 
                  align=center border=0>
                            <TBODY>
                              <TR>
                                <TD colSpan=3></TD>
                              </TR>
                              <TR>
                                <TD width=5></TD>
                                <TD width=547 vAlign=top bgColor=#FFFFFF><div align="center">
                                  <table width="524" height="360" border="0" align="center">
                                    <tr>
                                      <td width="518" height="356" bgcolor="#FFFFFF" valign="top"><div align="center">
                                          <Table bgColor="#CCCCCC" Width="100%" height="356" Border=0 CellSpacing=1 CellPadding=5>
    <Tr bgColor="#FFFFFF">
      <Td colspan="2" align=Right><div align="left">
          <p align="center"><SPAN class=style3><font color="#FF0000" size="3"><b>支付成功</b></font></SPAN></div></Td>         
    </TR>
    <Tr bgColor="#FFFFFF">
<td align="right" width="27%">
<p>服务名称:</p>
</td>
<td width="73%">
<p><%=v_servicename%></p>
</td>
    </TR>
    <Tr bgColor="#FFFFFF">
<td align="right" width="27%">
<p>支付金额:</p>
</td>
<td width="73%">
<p><%=v_price%> 分</p>
</td>
    </TR>
    <Tr bgColor="#FFFFFF">
<td align="right" width="27%">
<p>商户订单号:</p>
</td>
<td width="73%">
<p><%=v_billno%></p>
</td>
    </TR>
    <Tr bgColor="#FFFFFF">
<td align="right" width="27%">
<p>贺喜支付平台订单号:</p>
</td>
<td width="73%">
<p><%=v_orderid%></p>
</td>
    </TR>
    <Tr bgColor="#FFFFFF">
<td align="right" width="27%">
<p>支付途径:</p>
</td>
<td width="73%">
<p><%=v_payviastr%></p>
</td>
    </TR>
    <Tr bgColor="#FFFFFF">
<td align="right" width="27%">
<p>付款状态:</p>
</td>
<td width="73%">
<p><%=v_pstatus%></p>
</td>
    </TR>
    <Tr bgColor="#FFFFFF">
<td align="right" width="27%">
<p>付款状态说明:</p>
</td>
<td width="73%">
<p><%=v_pstring%></p>
</td>
    </TR>
    <Tr bgColor="#FFFFFF">
<td align="right" width="27%">
<p>订单成交时间:</p>
</td>
<td width="73%">
<p><%=v_orderdate%></p>
</td>
    </TR>
    <Tr bgColor="#FFFFFF">
<td align="right" width="27%">
<p>自定义字段1:</p>
</td>
<td width="73%">
<p><%=v_custom1%></p>
</td>
    </TR>
    <Tr bgColor="#FFFFFF">
<td align="right" width="27%">
<p>自定义字段2:</p>
</td>
<td width="73%">
<p><%=v_custom2%></p>
</td>
    </TR>
    <Tr bgColor="#FFFFFF">
<td align="right" width="27%">
<p>返回的加密字符串:</p>
</td>
<td width="73%">
<p><%=v_md5%></p>
</td>
    </TR>
    <Tr bgColor="#FFFFFF">
<td align="right" width="27%">
<p><font color="#FF0000"><b>说明:</b></font></p>
</td>
<td width="73%">
<p>支付返回页面中不需要显示的信息请自行删除。</p>
</td>
    </TR>

                                          </Table>
                                      </div></td>
                                    </tr>
                                  </table>
                                  </div></TD>
                                <TD width=5></TD>
                              </TR>
                              <TR>
                                <TD colSpan=3 height=5></TD>
                              </TR>
                            </TBODY>
                        </TABLE></TD>
                      </TR>
                      <TR>
                        <TD bgColor=#f7f3ef background="images/copy.gif" height="22"><DIV align=center>
                            <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
                              <TBODY>
                                <TR>
                                  <TD bgColor=#999999 height=1></TD>
                                </TR>
                                <TR>
                                  <TD height=1></TD>
                                </TR>
                                <TR>
                                  <TD bgColor=#999999 height=1></TD>
                                </TR>
                              </TBODY>
                            </TABLE>
                            版本:2.3JSP</DIV></TD>
                      </TR>
                    </TBODY>
                </TABLE></TD>
              </TR>
            </TBODY>
        </TABLE></TD>
      </TR>
    </TBODY>
  </TABLE>
  </center>
</div>
</body>

</html>
<%
}
else
{
//下面请放入定单支付失败页面的HTML代码
%>
<HTML><HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>支付失败</TITLE>
</HEAD>
<BODY>
<p>
支付失败
</p>
</BODY></HTML>
<%
}}
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -