- 微信拉起支付提示弹窗:支付验证签名失败。
拉不起支付,也无回调。附上代码实现和报错截图,麻烦技术大大帮忙看看啊,十分感谢!来来回回反复检查参数,没发现问题。。。 报错截图: [图片][图片] java服务端核心代码: @Override public ResultMap unifiedOrder(HttpServletRequest request, double amount,String account) { String body = "123"; String orderNo = DateUtils.creatOrderID(); Map<String, String> returnMap = new HashMap<>(); Map<String, String> responseMap = new HashMap<>(); Map<String, String> requestMap = new HashMap<>(); String nonce_str = RandomUtils.getRandom(30); try { WXPay wxpay = new WXPay(wxPayAppConfig); //微信分配的公众账号ID requestMap.put("appid", wxPayAppConfig.getAppID()); //微信支付分配的商户号 returnMap.put("mch_id", wxPayAppConfig.getMchID()); // App支付类型 requestMap.put("trade_type", "APP"); // 接收微信支付异步通知回调地址 requestMap.put("notify_url", wxPayAppConfig.getPayNotifyUrl()); // 终端IP requestMap.put("spbill_create_ip", HttpRequestUtil.getIpAddr(request)); // 总金额 requestMap.put("total_fee", String.valueOf((int)(amount*100))); //默认人民币 requestMap.put("fee_type","CNY"); // 商户订单号 requestMap.put("out_trade_no", orderNo); // 商品描述 requestMap.put("body", body); //随机字符串,不长于32位。推荐随机数生成算法 requestMap.put("nonce_str",nonce_str); //生成sign String createSign = WXPayUtil.generateSignature(requestMap, wxPayAppConfig.getKey()); requestMap.put("sign",createSign); Map<String, String> resultMap = wxpay.unifiedOrder(requestMap); //获取返回码 String returnCode = resultMap.get("return_code"); String returnMsg = resultMap.get("return_msg"); log.info("返回值:"+returnMsg); //若返回码为SUCCESS,则会返回一个result_code,再对该result_code进行判断 if ("SUCCESS".equals(returnCode)) { String resultCode = resultMap.get("result_code"); String errCodeDes = resultMap.get("err_code_des"); if ("SUCCESS".equals(resultCode)) { responseMap = resultMap; } } if (responseMap == null || responseMap.isEmpty()) { return ResultMap.error("获取预支付交易会话标识失败"); } // 3、签名生成算法 Long time = System.currentTimeMillis() / 1000; String timestamp = time.toString(); //微信分配的公众账号ID returnMap.put("appid", wxPayAppConfig.getAppID()); //微信支付分配的商户号 returnMap.put("mch_id", wxPayAppConfig.getMchID()); //微信返回的支付 交易会话ID 预支付交易会话标识 returnMap.put("prepayid", responseMap.get("prepay_id")); //随机字符串,不长于32位。推荐随机数生成算法 returnMap.put("noncestr", responseMap.get("nonce_str")); //商户订单号 returnMap.put("out_trade_no",orderNo); //商品描述 returnMap.put("body",body); returnMap.put("timestamp", timestamp); //微信支付签名 详见签名生成算法 String sign = WXPayUtil.generateSignature(returnMap, wxPayAppConfig.getKey()); resultMap.put("sign", sign); //时间戳,请见接口规则-参数规定 resultMap.put("timestamp", returnMap.get("timestamp")); //暂填写固定值Sign=WXPay resultMap.put("package", "Sign=WXPay"); //将充值记录添加到数据库 rechargeRecordServer.insertRechargeRecord(account,amount,orderNo); return ResultMap.ok().put("data", resultMap); } catch (Exception e) { logger.error("订单号:{},错误信息:{}", orderNo, e.getMessage()); return ResultMap.error("微信支付统一下单失败"); } } 安卓前端核心代码: static public void showPay(String appid, String partnerid, String prepayid, String noncestr, String timestamp, String packageX, String sign){ Log.e(TAG, "拉起安卓层支付" + appid + partnerid); // WXEntryActivity.onPayRequest(appid, partnerid, prepayid,noncestr,timestamp,packageX,sign); // WXEntryActivity.onPayRequest(appid, partnerid, prepayid, noncestr, timestamp, packageX, sign); IWXAPI api = WXAPIFactory.createWXAPI(activity, Constants.APP_ID); api.registerApp(Constants.APP_ID); PayReq req = new PayReq(); req.appId = appid; req.partnerId = partnerid; req.prepayId = prepayid; req.nonceStr = noncestr; req.timeStamp = timestamp; req.packageValue = packageX; //req.extData = "app data"; req.sign = sign; // 在支付之前,如果应用没有注册到微信,应该先调用IWXMsg.registerApp将应用注册到微信 //调用api接口,发送数据到微信 req.checkArgs(); api.sendReq(req); Log.e(TAG, "拉起安卓层支付2" + appid + partnerid); }
2021-02-07 - toTempFilePath截屏黑屏
同样都是调用Canvas.toTempFilePath()截图, 用2.0.8版本的cocoscreator构建成的小游戏截图成功但是黑屏,用1.9.1版本的cocoscreator就正常!请教一下这个是开发工具设置的问题吗?
2019-03-20