资源简介
易宝在线支付接口是根据黎活明老师的java网上在线支付实战课程并结合网上的活雷锋们提供的信息整合而成,本人亲测可用。
代码片段和文件信息
package com.swh.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.swh.util.ConfigInfo;
import com.swh.util.PaymentUtil;
//用于发起支付请求
/**
* 发起支付请求
* @see ==============================================================================================
* @see 测试商户
* @see p1_MerId=10000432521
* @see keyValue=8UPp0KE8sq73zVP370vko7C39403rtK1YwX40Td6irH216036H27Eb12792t
* @see ==============================================================================================
* @see 正式商户:本人亲测,可以直接连到银行页面
* @see p1_MerId=10001126856
* @see keyValue=69cl522AV6q613Ii4W6u8K6XuW8vM1N6bFgyv769220IuYe9u37N4y7rI4Pl
* @see ==============================================================================================
* @see accountCallbackURL=http://127.0.0.1:8088/payment/servlet/yeepay/PaymentResultServlet
* @see 此时机器需联网。若使用路由上的网,只要把路由的IP写进去,再在路由里配置一个8088端口的转发规则,即可
* @see ==============================================================================================
*/
public class PaymentRequest extends HttpServlet {
public void doGet(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {
this.doPost(request response);
}
public void doPost(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {
request.setCharacterEncoding(“GBK“);
/* //测试商户:商户编号
String accountID = “10000432521“;
//测试商户:密钥
String keyValue = “8UPp0KE8sq73zVP370vko7C39403rtK1YwX40Td6irH216036H27Eb12792t“;
//测试商户:商户接收支付成功数据的地址
String accountCallbackURL = “http://127.0.0.1:8088/payment/servlet/yeepay/PaymentResultServlet“;
*/
String orderID = request.getParameter(“orderID“);//订单号
String amount = request.getParameter(“amount“);//支付金额
String accountBankID = request.getParameter(“pd_FrpId“);//获取用户选择的支付银行
String accountID = ConfigInfo.getValue(“p1_Merid“);
String keyValue = ConfigInfo.getValue(“keyValue“);
String accountCallbackURL = ConfigInfo.getValue(“merchantCallbackURL“);
System.out.println(“accountID=“+accountID+“ keyValue=“+keyValue+“ accountCallbackURL=“+accountCallbackURL);
String businessType = “Buy“; //业务类型。Buy为在线支付
String currency = “CNY“; //交易币种。CNY为人民币
String productDesc = ““; //商品描述
String productCategory = ““; //商品种类
String productID = ““; //商品ID
String addressFlag = “0“; //送货地址。0为不需要,1为需要
String accountMoreInfo = ““; //商户扩展信息
String pr_NeedResponse = “0“; //应答机制
String md5hmac = PaymentUtil.buildHmac(
businessType accountID orderID amount currency productID productCategory
productDesc accountCallbackURL addressFlag accountMoreInfo accountBankID
pr
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2014-08-08 15:46 payment\
文件 340 2014-08-07 13:13 payment\.classpath
目录 0 2014-08-08 15:47 payment\.myeclipse\
文件 294 2014-08-07 13:13 payment\.myme
文件 1280 2014-08-07 16:40 payment\.project
目录 0 2014-08-08 15:46 payment\.settings\
文件 334 2014-08-07 13:13 payment\.settings\org.eclipse.jdt.core.prefs
目录 0 2014-08-08 15:46 payment\WebRoot\
目录 0 2014-08-08 15:46 payment\WebRoot\me
文件 36 2014-08-07 13:13 payment\WebRoot\me
目录 0 2014-08-08 15:46 payment\WebRoot\WEB-INF\
目录 0 2014-08-08 15:46 payment\WebRoot\WEB-INF\classes\
目录 0 2014-08-08 15:46 payment\WebRoot\WEB-INF\classes\com\
目录 0 2014-08-08 15:46 payment\WebRoot\WEB-INF\classes\com\swh\
目录 0 2014-08-08 15:46 payment\WebRoot\WEB-INF\classes\com\swh\servlet\
文件 2940 2014-08-07 17:29 payment\WebRoot\WEB-INF\classes\com\swh\servlet\PaymentRequest.class
文件 3215 2014-08-07 18:20 payment\WebRoot\WEB-INF\classes\com\swh\servlet\PaymentResultServlet.class
目录 0 2014-08-08 15:46 payment\WebRoot\WEB-INF\classes\com\swh\util\
文件 813 2014-08-07 18:02 payment\WebRoot\WEB-INF\classes\com\swh\util\ConfigInfo.class
文件 2259 2014-08-07 17:29 payment\WebRoot\WEB-INF\classes\com\swh\util\DigestUtil.class
文件 2161 2014-08-07 17:56 payment\WebRoot\WEB-INF\classes\com\swh\util\PaymentUtil.class
文件 178 2014-08-07 18:25 payment\WebRoot\WEB-INF\classes\merchantInfo.properties
目录 0 2014-08-08 15:47 payment\WebRoot\WEB-INF\lib\
目录 0 2014-08-08 15:47 payment\WebRoot\WEB-INF\page\
文件 1786 2014-08-07 18:28 payment\WebRoot\WEB-INF\page\connection.jsp
文件 484 2014-08-07 18:16 payment\WebRoot\WEB-INF\page\paymentResult.jsp
文件 1190 2014-08-07 17:23 payment\WebRoot\WEB-INF\web.xm
文件 4304 2014-08-07 16:47 payment\WebRoot\index.jsp
目录 0 2014-08-08 15:46 payment\src\
目录 0 2014-08-08 15:46 payment\src\com\
目录 0 2014-08-08 15:46 payment\src\com\swh\
............此处省略8个文件信息
评论
共有 条评论