问提解决了,不用闲的无聊的官方客服了; 问题原因:同样的证书,在linux和windows下得到商户号不一样
下单接口报“签名错误”微信下单接口签名错误,已经按照文档排查了所有可能的原因,在windows开发电脑上可以下单成功,部署在linux服务器后报签名错误,证书是一样的,服务器时间也是和互联网同步的 Config config2 =new RSAPublicKeyConfig.Builder() .merchantId("1722*****57") //微信支付的商户号 .privateKeyFromPath("/data/server/vr-cloud/cert/apiclient_key.pem") // 商户API证书私钥的存放路径 .publicKeyFromPath("/data/server/vr-cloud/cert/pub_key.pem") //微信支付公钥的存放路径 .publicKeyId("PUB_KEY_ID_011722*****90200181519001404") //微信支付公钥ID .merchantSerialNumber("244654B772*****5F24197E35B60E3A3B9") //商户API证书序列号 .apiV3Key("8d80274ed27*****c50ab15fff78de") //APIv3密钥 .build(); // 构建service JsapiService service = new JsapiService.Builder().config(config2).build(); PrepayRequest request = new PrepayRequest(); request.setAppid("wx7*****07f5db088"); request.setMchid(merchantId); request.setDescription("商品描述"); request.setOutTradeNo("VR"+System.currentTimeMillis()); request.setNotifyUrl("https://wxpay.*****.*****/wx/v1/jsapi/callback"); Payer payer=new Payer(); payer.setOpenid(openId); request.setPayer(payer); Amount amount = new Amount(); amount.setTotal(5000); request.setAmount(amount); // 调用下单方法,得到应答 PrepayResponse response = service.prepay(request);
09-19"Wrong HttpStatusCode[401]\nhttpResponseBody[{\"code\":\"SIGN_ERROR\",\"detail\":{\"detail\":{\"issue\":\"sign not match\"},\"field\":\"signature\",\"location\":\"authorization\",\"sign_information\":{\"method\":\"POST\",\"sign_message_length\":358,\"truncated_sign_message\":\"POST\\n/v3/pay/transactions/jsapi\\n1758268980\\nr9BoTpcLfrJfdXsdHOSkQno38v2LEvqV\\n{\\\"appid\\\"\\n\",\"url\":\"/v3/pay/transactions/jsapi\"}},\"message\":\"签名错误,请检查后再试\"}]\tHttpRequest[{\"http_method\":\"POST\",\"url\":\"https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi\",\"uri\":\"https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi\",\"headers\":{\"headers\":{\"Authorization\":\"WECHATPAY2-SHA256-RSA2048 mchid=\\\"172****57\\\",nonce_str=\\\"r9BoTpcLfrJfdXsdHOSkQno38v2LEvqV\\\",timestamp=\\\"1758268980\\\",serial_no=\\\"244654B7724AACA049A925F24197E35B60E3A3B9\\\",signature=\\\"tO5qAUjjHN8Kj8trbG2BTaMp7jGSlUhhlDBMD0Au3Tvjcq+4OiESuOnViXGc8V/2EGDu/LrpB4rtG7S1ZcjIuYpoT6AMyeb5B07NmzCqxV997VuG86HIkpGXGlbDRI/KV/DyTR7Mgs87Nia787cnbmUZ5E/dnZFgs4ZNsgyO4IBLGA86N3meGu86h2DIU+nK0ku0YIHKhIj84HNOfnSkRzUlPdkPH79YrdHuQESuvrGENgaQkLNktSMhgQko111NdSDRBkWYd3Oy2qXqK1IkOV4XH17zUMhxotfwEqywVNGnd/UlsFumCmtizkX62PKdxmakwayoh8lrYdN+aSy4ug==\\\"\",\"Accept\":\"application/json\",\"User-Agent\":\"WechatPay-Java/0.2.17 (Linux/3.10.0-514.26.2.el7.x86_64) Java/1.8.0_161 Credential/WechatPay2Credential Validator/WechatPay2Validator okhttp3/null\",\"Content-Type\":\"application/json\",\"Wechatpay-Serial\":\"PUB_KEY_ID_011722993****00181519001404\"}},\"body\":{\"body\":\"{\\\"appid\\\":\\\"wx7e88****f5db088\\\",\\\"mchid\\\":\\\"1722993157\\\",\\\"description\\\":\\\"随着无人机视角720度全景浏览黄河风光\\\",\\\"out_trade_no\\\":\\\"10000019\\\",\\\"notify_url\\\":\\\"https://wxpay.yukong.live/wx/v1/jsapi/callback\\\",\\\"amount\\\":{\\\"total\\\":5000},\\\"payer\\\":{\\\"openid\\\":\\\"ofhgD7in****Mlbjo-5-7mr6g\\\"}}\"}}]" }
下单接口报“鉴权错误”微信下单接口鉴权错误,已经按照文档排查了所有可能的原因,在windows开发电脑上可以下单成功,部署在linux服务器后报鉴权错误,证书是一样的,服务器时间也是和互联网同步的 Config config2 =new RSAPublicKeyConfig.Builder() .merchantId("1722*****57") //微信支付的商户号 .privateKeyFromPath("/data/server/vr-cloud/cert/apiclient_key.pem") // 商户API证书私钥的存放路径 .publicKeyFromPath("/data/server/vr-cloud/cert/pub_key.pem") //微信支付公钥的存放路径 .publicKeyId("PUB_KEY_ID_011722*****90200181519001404") //微信支付公钥ID .merchantSerialNumber("244654B772*****5F24197E35B60E3A3B9") //商户API证书序列号 .apiV3Key("8d80274ed27*****c50ab15fff78de") //APIv3密钥 .build(); // 构建service JsapiService service = new JsapiService.Builder().config(config2).build(); PrepayRequest request = new PrepayRequest(); request.setAppid("wx7*****07f5db088"); request.setMchid(merchantId); request.setDescription("商品描述"); request.setOutTradeNo("VR"+System.currentTimeMillis()); request.setNotifyUrl("https://wxpay.*****.*****/wx/v1/jsapi/callback"); Payer payer=new Payer(); payer.setOpenid(openId); request.setPayer(payer); Amount amount = new Amount(); amount.setTotal(5000); request.setAmount(amount); // 调用下单方法,得到应答 PrepayResponse response = service.prepay(request);
09-19