利用javaweb实现一个在线支付功能-创新互联
创新互联www.cdcxhl.cn八线动态BGP香港云服务器提供商,新人活动买多久送多久,划算不套路!
成都创新互联公司服务项目包括罗定网站建设、罗定网站制作、罗定网页制作以及罗定网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,罗定网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到罗定省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!今天就跟大家聊聊有关利用javaweb实现一个在线支付功能,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。
具体内容如下
package com.learning.web.servlet; import java.io.IOException; import java.util.ResourceBundle; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.learning.utils.PaymentUtil; @WebServlet("/payOnline") public class PayOnline extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String orderid = request.getParameter("orderid"); String money = request.getParameter("money"); // 银行 String pd_FrpId = request.getParameter("pd_FrpId"); // 发给支付公司需要哪些数据 String p0_Cmd = "Buy"; String p1_MerId = ResourceBundle.getBundle("/WEB-INF/classes/merchantInfo").getString( "p1_MerId"); String p2_Order = orderid; String p3_Amt = money; String p4_Cur = "CNY"; String p5_Pid = ""; String p6_Pcat = ""; String p7_Pdesc = ""; // 支付成功回调地址 ---- 第三方支付公司会访问、用户访问 // 第三方支付可以访问网址(本项目网址) String p8_Url = "http://115.170.37.189/day19pay/callback"; String p9_SAF = ""; String pa_MP = ""; String pr_NeedResponse = "1"; // 加密hmac 需要密钥 String keyValue = ResourceBundle.getBundle("merchantInfo").getString( "keyValue"); 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, keyValue); // 生成url --- url? request.setAttribute("pd_FrpId", pd_FrpId); 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("hmac", hmac); request.getRequestDispatcher("/confirm.jsp").forward(request, response); } }
当前名称:利用javaweb实现一个在线支付功能-创新互联
网站路径:http://azwzsj.com/article/ceshoj.html