- 微信支付回调验证签名问题:Processing WechatPay notification?
报错:Processing WechatPay notification,signature verification failed,signType[WECHATPAY2-SHA256-RSA2048] 原因:HTTP 请求体 body。切记使用原始报文,不要用 JSON 对象序列化后的字符串,避免验签的 body 和原文不一致。(body顺序乱了不行,HttpServletRequest只能被读取一次) 处理HttpServletRequest工具类: import com.wechat.pay.java.core.notification.RequestParam; import javax.servlet.ServletInputStream; import javax.servlet.http.HttpServletRequest; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; public class HttpServletRequestUtils { public static String getRequestBody(HttpServletRequest request) { StringBuilder sb = new StringBuilder(); try (ServletInputStream inputStream = request.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); ) { String line; while ((line = reader.readLine()) != null) { sb.append(line); } } catch (IOException e) { System.out.println(e.getMessage()); } return sb.toString(); } public static RequestParam createRequestParam(HttpServletRequest request){ String body = getRequestBody(request); String timestamp = request.getHeader("Wechatpay-Timestamp"); String nonce = request.getHeader("Wechatpay-Nonce"); String signature = request.getHeader("Wechatpay-Signature"); String singType = request.getHeader("Wechatpay-Signature-Type"); String number = request.getHeader("Wechatpay-Serial"); return new RequestParam.Builder() .nonce(nonce) .signature(signature) .signType(singType) .timestamp(timestamp) .serialNumber(number) .body(body) .build(); } }
03-30 - wx.getLocation接口符合业务场景为什么一直没过呢?
我们小程序主要是做上门回收的业务。 有两个应用场景,第一个是回收员根据用户经纬度导航,上门回收废品。 另一个场景是,用户授权地理位置信息,展示最近的站点,让用户自己去站点卖废品。 请问这个业务为什么不符合wx.getLocation(获取当前的地理位置、速度)接口的开放范围? 特别着急上线新版小程序,希望官方人员帮忙看看,感谢感谢,谢谢 [图片][图片][图片]
2022-10-15 - 微信开发工具调试器无法打印日志?重启过程序,重启过电脑,有一次重启电脑行了,之后又不打印日志了
[图片]
2020-10-23