config设置错了,这个配置会用平台证书验证response的签名,就不会报错了 // 示例代码 Config config = new RSAAutoCertificateConfig.Builder() .merchantId(mchid) .privateKeyFromPath(privateKeyPath) .merchantSerialNumber(merchantSerialNumber) .apiV3Key(apiV3key) .build(); JsapiServiceExtension service = new JsapiServiceExtension.Builder().config(config).build(); QueryOrderByOutTradeNoRequest queryRequest = new QueryOrderByOutTradeNoRequest(); queryRequest.setMchid(mchid); queryRequest.setOutTradeNo(outTradeNo);
Validate response failed,the WechatPay signature?v3,调用SDK,jspiService.prepay,提示错误信息com.wechat.pay.java.core.exception.ValidationException: Validate response failed,the WechatPay signature is incorrect. 同事打印出了Request-IDhe responseHeader和 responseBody,包含了prepay_id,说明我的下单已经成功了,但是sdk响应数据一直错误。 哪位大佬帮忙解决一下
2023-03-01正确答案: config设置错了,这个配置会用平台证书验证response的签名,就不会报错了 // 示例代码 Config config = new RSAAutoCertificateConfig.Builder() .merchantId(mchid) .privateKeyFromPath(privateKeyPath) .merchantSerialNumber(merchantSerialNumber) .apiV3Key(apiV3key) .build(); JsapiServiceExtension service = new JsapiServiceExtension.Builder().config(config).build(); QueryOrderByOutTradeNoRequest queryRequest = new QueryOrderByOutTradeNoRequest(); queryRequest.setMchid(mchid); queryRequest.setOutTradeNo(outTradeNo);
BUG?【微信支付商户证书号】回调的时候参数变了,导致验证失败配置中提交的微信支付商户证书号, 回调之后的参数中的微信支付商户证书号与提交的微信支付商户证书号参数不一致,导致验证失败。 RSAConfig configgg = new RSAConfig.Builder() .merchantId(merchantId) // 使用 com.wechat.pay.jav中的函数从本地文件中加载商户私钥a.core.util // ,商户私钥会用来生成请求的签名 // .privateKey(privateKeyString) .privateKey(merchantPrivateKey) // .privateKeyFromPath(privateKeyPath) .merchantSerialNumber("1E2DDBE63EB76C202A6ADF5FACA2D721A315B6E1") .wechatPayCertificates(merchantCertificateKey) // .wechatPayCertificatesFromPath(MERCHANT_CERTIFICATE_STRING) .build(); 提交的 1E2DDBE63EB76C202A6ADF5FACA2D721A315B6E1 回调的 6544DD6CBB9A62064D430FC1958391DDB243B564 2022-08-30 17:03:24.522 12714-12714/com.tunshugongshe.client E/AndroidRuntime: FATAL EXCEPTION: main Process: com.tunshugongshe.client, PID: 12714 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tunshugongshe.client/com.tunshugongshe.client.activity.shoppingCart.OrderSettlementtActivity}: com.tunshugongshe.client.webchat.core.exception.ValidationException: Validate response failed,the WechatPay signature is incorrect. Request-ID[08DCA4B7980610A906189DE0B74C209FFA0F28FCAE04-0] responseHeader[Keep-Alive=timeout=8,Wechatpay-Timestamp=1661850205,Server=nginx,X-Content-Type-Options=nosniff,Connection=keep-alive,Date=Tue, 30 Aug 2022 09:03:25 GMT,Wechatpay-Signature-Type=WECHATPAY2-SHA256-RSA2048,Wechatpay-Serial=6544DD6CBB9A62064D430FC1958391DDB243B564,Wechatpay-Nonce=b498e4bd510262f44b9de073f53c2ebc,Wechatpay-Signature=vL+BiavViLJbBL29USqkuTmGNhhdBG2hS+TtCtKMqv/GvjwEbQ2fh1xotWvcQsKGXgzWHh//OLmA5jUZBEVlYlkt8HmKCGq8d5M2Q6M4+yPsCJ6kv1zjFKHcoIj8HX43OTLGPGojYoPK+1SoXBeD86KSy47PGRX0B1N2QfDgxLudbA0fE7HXyEBWxgAPDO5V7xiKIc8NO0yuuQbfHuUMp77ecQq4MgAHX3B70G2A2AqxemD+XnXz44miMAWi95klGC0W5un1JbV3xt8lQ1fSiIqNM8e/r5zKVSDmOt+B7nSy1dAUYTdIrjb0R9PDGf/wV9jofnfaDufzvfFlO/NKmQ==,Cache-Control=no-cache, must-revalidate,Content-Length=52,Request-ID=08DCA4B7980610A906189DE0B74C209FFA0F28FCAE04-0,Content-Language=zh-CN,Content-Type=application/json; charset=utf-8 ] responseBody[{"prepay_id":"wx301703249909580aa1fc28f7cee87f0000"}]
2023-03-01