1、支付请求
<form action="${pageContext.request.contextPath}/yinlian?op=pay" method="post">
<div style=" 100%;" align="center">
<div style="background-color:gray; 550px;margin: 0px;padding: 0px;">
<br><br><br>
<img src="img/19.png"/><br><br><br>
<input type="text" placeholder ="请您输入订单号" name="number" style="border-radius:6px; 500px;height: 30px;border: none"><br><br>
<input type="text" name="b" onfocus=this.blur() value="0.01" style="border-radius:6px; 500px;height: 30px;border: none"><br><br><br>
<input type="radio" name="pd_FrpId" value="ICBC-NET-B2C"><img src="img/11.jpg"/>
<input type="radio" name="pd_FrpId" value="CMBCHINA-NET-B2C"><img src="img/12.jpg"/>
<input type="radio" name="pd_FrpId" value="ABC-NET-B2C"><img src="img/13.jpg"/><br><br>
<input type="radio" name="pd_FrpId" value="CCB-NET-B2C"><img src="img/14.jpg"/>
<input type="radio" name="pd_FrpId" value="BCCB-NET-B2C"><img src="img/15.jpg"/>
<input type="radio" name="pd_FrpId" value="BOC-NET-B2C"><img src="img/16.JPG"/><br><br><br>
<input type="submit" value="确定提交" style="background-color: #ff7e00;border-radius:6px; 500px;height: 30px;color: white;border:none;font-size: 18px">
<br><br><br>
</div>
</div>
</form>
2、servlet整理数据
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
String op = request.getParameter("op");
if ("pay".equals(op)) {
pay(request, response);
}
}
private void pay(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String name = request.getParameter("number");
String money = request.getParameter("b");
String pd_FrpId = request.getParameter("pd_FrpId");
String p0_Cmd = "Buy";// 业务类型
String p1_MerId = "10001126856";// 第三方商户id
String p2_Order = name;// 商户订单号
String p3_Amt = money;// 支付金额
String p4_Cur = "CNY";// 交易币种
String p5_Pid = "unknown";// 商品名称
String p6_Pcat = "unknown";// 商品种类
String p7_Pdesc = "unknown";// 商品描述
String p8_Url = "http://localhost:8080/ZhiFu/servlet/PaymentResponse";// 商户接收支付成功数据的地址
String p9_SAF = "1";// 送货地址
String pa_MP = "no";// 商户扩展信息
String pr_NeedResponse = "1";// 应答机制
String hmac = PaymentUtil.buildHmac(p0_Cmd, p1_MerId, p2_Order, p3_Amt,
p4_Cur, p5_Pid, p6_Pcat, p7_Pdesc, p8_Url, p9_SAF, pa_MP,
pd_FrpId, pr_NeedResponse,
"69cl522AV6q613Ii4W6u8K6XuW8vM1N6bFgyv769220IuYe9u37N4y7rI4Pl");// 签名数据
request.setAttribute("p0_Cmd", p0_Cmd);
request.setAttribute("p1_MerId", p1_MerId);
request.setAttribute("p2_Order", p2_Order);
request.setAttribute("p3_Amt", p3_Amt);
request.setAttribute("p4_Cur", p4_Cur);
request.setAttribute("p5_Pid", p5_Pid);
request.setAttribute("p6_Pcat", p6_Pcat);
request.setAttribute("p7_Pdesc", p7_Pdesc);
request.setAttribute("p8_Url", p8_Url);
request.setAttribute("p9_SAF", p9_SAF);
request.setAttribute("pa_MP", pa_MP);
request.setAttribute("pr_NeedResponse", pr_NeedResponse);
request.setAttribute("pd_FrpId", pd_FrpId);
request.setAttribute("hmac", hmac);
request.getRequestDispatcher("YinlianzhifuSure.jsp").forward(request,
response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
doGet(request, response);
}
3、jsp整理数据
<form action="https://www.yeepay.com/app-merchant-proxy/node" method="post">
<input type="hidden" name="p0_Cmd" value="${p0_Cmd}">
<input type="hidden" name="p1_MerId" value="${p1_MerId}">
<input type="hidden" name="p2_Order" value="${p2_Order}">
<input type="hidden" name="p3_Amt" value="${p3_Amt}">
<input type="hidden" name="p4_Cur" value="${p4_Cur}">
<input type="hidden" name="p5_Pid" value="${p5_Pid}">
<input type="hidden" name="p6_Pcat" value="${p6_Pcat}">
<input type="hidden" name="p7_Pdesc" value="${p7_Pdesc}">
<input type="hidden" name="p8_Url" value="${p8_Url}">
<input type="hidden" name="p9_SAF" value="${p9_SAF}">
<input type="hidden" name="pa_MP" value="${pa_MP}">
<input type="hidden" name="pr_NeedResponse" value="${pr_NeedResponse}">
<input type="hidden" name="pd_FrpId" value="${pd_FrpId}">
<input type="hidden" name="hmac" value="${hmac}">
</form>