Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支付宝后台接口加签方式设置为证书时,v2版本的UserInfoShare方法请求验签不通过 #452

Open
zz-fdc opened this issue Jan 16, 2025 · 2 comments

Comments

@zz-fdc
Copy link

zz-fdc commented Jan 16, 2025

https://github.com/go-pay/gopay/blob/main/alipay/client.go#L173-L178
pubParamsHandle方法在处理加签时,app_cert_sn,alipay_root_cert_sn的赋值应该放在if bm != nil 的外面,像UserInfoShare这种没有body的方法,bm为空,就不会将app_cert_sn,alipay_root_cert_sn赋值给pubBody,所以签名的时候就不会带上这两个值,支付宝后台接口加签方式设置为证书时,发起请求就会出现验签不通过,得到错误isv.invalid-signature

当我手动将app_cert_sn,alipay_root_cert_sn设置为请求参数,并进行签名发起请求就可以请求成功

@iGoogle-ink
Copy link
Member

赞同你的观点,有些与 bodymap无关的参数,确实可以在外面做

@iGoogle-ink
Copy link
Member

app_cert_sn、alipay_root_cert_sn、return_url、notify_url、app_auth_token 这几个参数,理论是都可以前置判断是否赋值。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants