使用的官方SDK中的QuickStart
https://github.com/wechatpay-apiv3/wechatpay-java
[{"code":"SIGN_ERROR","detail":{"detail":{"issue":"sign not match"},"field":"signature","location":"authorization","sign_information":{"method":"POST","sign_message_length":255,"truncated_sign_message":"POST\n/v3/pay/transactions/native\n1766483670\nACnh2ue9GIw4pfM68wXMgHe7szDTl9Ma\n{\"appid\"\n","url":"/v3/pay/transactions/native"}},"message":"签名错误,请检查后再试"}]
请问官方有提供签名校验工具吗?下载到本地输入证书,商户号等信息后自动测试的。目前看都是根据指引下载的证书和公钥文件啥的。应该没问题。
现在不知道是文件有问题,密钥有问题还是什么地方有问题!
// 使用微信支付公钥的RSA配置
Config config =
new RSAPublicKeyConfig.Builder()
.merchantId(merchantId)
.privateKeyFromPath(privateKeyPath)
.publicKeyFromPath(publicKeyPath)
.publicKeyId(publicKeyId)
.merchantSerialNumber(merchantSerialNumber)
.apiV3Key(apiV3Key)
.build();

官方 sdk 报错签名问题一般是商户私钥给的不对
有根据文档https://pay.weixin.qq.com/doc/v3/merchant/4012072428校验,和微信商户后台显示的有使用次数的商户证书序列号是一致的。
pub_key.pem也是下载的微信支付公钥和对应的PUB_KEY_ID_011504***
微信支付商户平台上好像也没有说得重新申请证书来的https://pay.weixin.qq.com/doc/v3/merchant/4012072428。
请问您说的商户私钥给的不对具体有哪些可能的情况?
请问您说的不是一个正常的私钥是什么情况?该如何验证呢?
我也是使用的公钥模式,RSA配置代码和你一样。
我在.publicKeyFromPath(publicKeyPath)这行报错: Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.wechat.pay.java.core.Config]: Factory method 'wechatPayConfigBuild' threw exception with message: Illegal base64 character 2d 请问这是什么问题,公钥证书不对吗?然后我publicKeyFromPath路径用的就是apiclient_cert.pem文件。