1、面对面支付分为扫码支付PreCreatePay(用户扫商家生成的二维码)和条码支付BarCodePay(商家扫用户二维码)
2、文件名:AlipayNotify.jsp(信息回调接收页面)、BarCodePay.html/jsp(条码支付)、PreCreatePay.html/jsp(扫码支付)、Query.html/jsp(查询交易信息)、Refund.html/jsp(交易退款)、Cancel.java(撤销交易)、CheckQuery.java(ajax 查询交易)、Method.java(生成请求数据,生成请求连接、请求支付宝服务器、查询逻辑、撤销逻辑)、web.xml(配置ajax 关联到CheckQuery.java)
3、数据签名方法最终会直接调用alipay-sdk-java20161213173952.jar,这个jar里面有支付宝封装好的签名方法
4、境内支付宝使用的是RSA2密钥,可自行根据支付宝集成的官网指引获取
5、网关地址:测试环境为:https://openapi.alipaydev.com/gateway.do
正式环境为:https://openapi.alipay.com/gateway.do (具体以官网集成文档为准)
拼接、发送请求主要调用代码如下:
SimpleDateFormat date_out_trade_no = new SimpleDateFormat("yyyyMMddHHmmss");
String out_trade_no = date_out_trade_no.format(new Date());
String total_amount = request.getParameter("total_amount");
String discountable_amount = request.getParameter("discountable_amount");
String subject = request.getParameter("subject");
String body = out_trade_no;
String operatorId = request.getParameter("operatorId");
String providerId = properties.pid;
String extend_params = "{" + "\"sys_service_provider_id\":\"" + providerId + "\"" + "}";
String timeout_express = request.getParameter("timeout_express");
String scene = "bar_code";
String auth_code = request.getParameter("auth_code");
String method = "alipay.trade.pay";
String method2 = method.replace(".", "_");
String biz_content = "";
biz_content += "{"
+ "\"out_trade_no\":\"" + out_trade_no
+ "\"," + "\"scene\":\"" + scene
+ "\"," + "\"auth_code\":\"" + auth_code
+ "\","