Closed MyOnlyCat closed 5 years ago
IJPay 中的支付宝支付是对 alipay-sdk-java-all 的二次封装。在 alipay-sdk-java-all 中目前没有封装此接口,所以目前还不支持,后期想办法扩展一下。
好的,已用常规Http请求解决,还是谢谢 大佬开发的轮子
@MyOnlyCat 你那边使用常规 Http 请求支付接口,返回的数据是正常的?我这边测试返回的数据是空
@RequestMapping(value = "/wapPayNoSdk")
@ResponseBody
public void wapPayNoSdk(HttpServletResponse response) {
try {
AliPayApiConfig aliPayApiConfig = AliPayApiConfigKit.getAliPayApiConfig();
Map<String, String> paramsMap = new HashMap<>();
paramsMap.put("app_id", aliPayApiConfig.getAppId());
paramsMap.put("method", "alipay.trade.wap.pay");
paramsMap.put("return_url", aliPayBean.getDomain() + "aliPay/return_url");
paramsMap.put("charset", aliPayApiConfig.getCharset());
paramsMap.put("sign_type", aliPayApiConfig.getSignType());
paramsMap.put("timestamp", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
paramsMap.put("version", "1.0");
paramsMap.put("notify_url", aliPayBean.getDomain() + "/aliPay/notify_url");
Map<String, String> bizMap = new HashMap<>();
bizMap.put("body", "IJPay 聚合支付-H5");
bizMap.put("subject", "IJPay 让支付触手可及");
bizMap.put("out_trade_no", StringUtils.getOutTradeNo());
bizMap.put("total_amount", "6.66");
bizMap.put("product_code", "QUICK_WAP_WAY");
paramsMap.put("biz_content", JSON.toJSONString(bizMap));
String content = PayKit.createLinkString(paramsMap);
System.out.println(content);
String encrypt = RsaKit.encryptByPrivateKey(content, aliPayApiConfig.getPrivateKey());
System.out.println(encrypt);
// encrypt = AlipaySignature.rsaSign(content,aliPayApiConfig.getPrivateKey(), "UTF-8","RSA2");
// System.out.println(encrypt);
paramsMap.put("sign", encrypt);
Map<String, Object> temp = new HashMap<String, Object>(paramsMap.size());
temp.putAll(paramsMap);
String form = HttpKit.getDelegate().get(aliPayApiConfig.getServiceUrl(), temp);
System.out.println(aliPayApiConfig.getServiceUrl() + ">>>结果>>>>" + form);
response.setContentType("text/html;charset=" + aliPayApiConfig.getCharset());
OutputStream out = response.getOutputStream();
out.write(form.getBytes(aliPayApiConfig.getCharset()));
response.getOutputStream().flush();
} catch (Exception e) {
e.printStackTrace();
}
}
即时到账交易接口
-文档地址
交流群