我的Authorization格式是下面这样的 WECHATPAY2-SHA256-RSA2048 mchid="1685248***",nonce_str="83D393ABA84243EC921697CDAB65E4F8",signature="Lsf2tJc0TgQZe4SNkpw3DPYA7CDqZruEDTsyyc3FEfuTgGkwce2pWdhV8DZNdPCR+XLdazU1XQ2BRpi8lvi+RXIyn5q51TFdl8fD4PKhHnTsMex9et+oKskukR0f2eg3PCX+Xby8WksQ/Fhn3qTFovn/nAhCxv5I8jJUfaGjUgcMr+fu4ir9clD5oDFXdEJPvmFsxggbEwvLjStG/pWnQIgl3NSWCJYCEowNErlFhzSZ0EyoqbSOlURHWKl73Twkw3Gjo+SjTTUOZdQmbzRqB1JOe36anbxhOmiGni2IQIvSOPE357u6LJUphVVAfpYLbnZKK3Mk65ZZ2E+Ohy8PSw==",timestamp="1727312637",serial_no="4CF9FF7FBDF784C1222914607784A0C14F18***" <dependency> <groupId>com.github.wechatpay-apiv3</groupId> <artifactId>wechatpay-java</artifactId> <version>0.2.14</version> </dependency> 这个是我导入的包
服务商功能 接入商户进件接口提示"message”:"Http头Authorization值格式错误[图片] 部分代码: String auth = " WECHATPAY2-SHA256-RSA2048 mchid=\""+merchantId+"\",nonce_str=\""+ nonce +"\",signature=\"" +sign + "\",timestamp=\"" +String.valueOf(timestamp) + "\",serial_no=\"" + getSerialNumber() + "\""; //String auth = PayKit.getAuthorization(merchantId,getSerialNumber(),nonce,String.valueOf(timestamp),sign,"WECHATPAY2-SHA256-RSA2048"); /*String auth = "WECHATPAY2-SHA256-RSA2048 " + "mchid=\""+merchantId+"\",timestamp=\""+ timestamp +"\",nonce_str=\"" +nonce + "\",serial_no=\"" + getSerialNumber() + "\",signature=\"" + sign + "\"";*/ System.out.println("======================"); System.out.println(auth); System.out.println("======================"); String url = "https://api.mch.weixin.qq.com/v3/applyment4sub/applyment/"; CloseableHttpClient httpclient = HttpClients.createDefault(); HttpPost httppost = new HttpPost(url); String res = ""; try { StringEntity strEntity = new StringEntity(body, "utf-8"); strEntity.setContentEncoding("UTF-8"); strEntity.setContentType("application/json"); //下面几个Header必须设置 httppost.addHeader("Authorization", auth); httppost.addHeader("Content-Type", "application/json"); httppost.addHeader("Accept", "application/json"); //这里的User-Agent根据自己的实际情况来 // httppost.addHeader("User-Agent", "WeChatPay-IJPay-HttpClient/4.5 (Windows 10/10.0) Java/1.8.0_221"); //微信平台证书序列号 httppost.addHeader("Wechatpay-Serial", getPlatSerialNumber()); =================================== b不知道哪里出了问题了,弄了好久,Authorization应该怎么填?还是应该怎么处理
09-26