微信app支付问题请教:用的jfinal-weixin-2.1.jar做的后台接口
微信支付接口签名校验工具、微信公众平台支付接口调试工具都测试过,签名没有问题,
prepay_id能正常返回。
安卓前端就是提示errCode = -1
08-21 10:40:42.658 12500-12500 D/WXPayEntryActivity: transaction onResp null
微信支付完成, errCode = -1
null
项目:weixin_guide
微信app支付问题请教:用的jfinal-weixin-2.1.jar做的后台接口
微信支付接口签名校验工具、微信公众平台支付接口调试工具都测试过,签名没有问题,
prepay_id能正常返回。
安卓前端就是提示errCode = -1
08-21 10:40:42.658 12500-12500 D/WXPayEntryActivity: transaction onResp null
微信支付完成, errCode = -1
null
Map params = new HashMap();
String nonceStr = String.valueOf(System.currentTimeMillis() / 1000);
params.put("appid", appid);
params.put("mch_id", partner);
params.put("nonce_str", nonceStr);
params.put("body", "订单");
params.put("attach", "custom json");
params.put("out_trade_no", outtradeno);
params.put("total_fee", String.valueOf(price));
String ip = IpKit.getRealIp(getRequest());
if (StrKit.isBlank(ip)) {
ip = "127.0.0.1";
}
params.put("spbill_create_ip", ip);
params.put("notify_url", notify_url);
params.put("trade_type", "APP");
String sign = PaymentKit.createSign(params, paternerKey);
params.put("sign", sign);
String xmlResult = PaymentApi.pushOrder(params);
System.out.println(xmlResult);
Map result = PaymentKit.xmlToMap(xmlResult);
String return_code = result.get("return_code");
String return_msg = result.get("return_msg");
if (StrKit.isBlank(return_code) || !"SUCCESS".equals(return_code)) {
renderJson("{\"code\":\"201\",\"data\":" + return_msg
+ "}");
return;
}
String result_code = result.get("result_code");
if (StrKit.isBlank(result_code) || !"SUCCESS".equals(result_code)) {
renderJson("{\"code\":\"201\",\"data\":" + return_msg
+ "}");
return;
}
// 以下字段在return_code 和result_code都为SUCCESS的时候有返回
String prepay_id = result.get("prepay_id");
//封装调起微信支付的参数 https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_12
Map packageParams = new HashMap();
packageParams.put("appid", appid);
packageParams.put("partnerid", partner);
packageParams.put("prepayid", prepay_id);
packageParams.put("packagevalue", "Sign=WXPay");
packageParams.put("noncestr", nonceStr);//String.valueOf(System.currentTimeMillis()));
packageParams.put("timestamp", String.valueOf(System.currentTimeMillis() / 1000));
String packageSign = PaymentKit.createSign(packageParams, paternerKey);
packageParams.put("sign", packageSign);
String jsonStr = JsonUtils.toJson(packageParams);
// System.out.println("最新返回apk的参数:"+jsonStr);
renderJson("{\"code\":\"200\",\"data\":" + jsonStr
+ "}");
return;