wechatpay-apiv3 / wechatpay-go

微信支付 APIv3 的官方 Go Library
https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/index.shtml
Apache License 2.0
1.03k stars 141 forks source link

回调接口报错 #143

Closed bluedragonflyliu closed 1 year ago

bluedragonflyliu commented 1 year ago

验证成功回调老报错 notify request: validate verify fail serial=[583] request-id=[] err=certificate[583] not found in verifier file

wechatpay-go@v0.2.14 这个证书并不存在 支付下单时创建的client 使用的certificateSerialNo 也不是58****3 支付和验证回调使用的相同配置 cert, err := utils.LoadCertificate(wechatPayConfig.ApiclientCert) if err != nil{ return err }

handler := notify.NewNotifyHandler(wechatPayConfig.MchAPIv3Key, verifiers.NewSHA256WithRSAVerifier(core.NewCertificateMap(map[string]*x509.Certificate{wechatPayConfig.MchCertificateSerialNumber:cert})))
_, err = handler.ParseNotifyRequest(context.Background(), r, content)

使用的时gin框架

bluedragonflyliu commented 1 year ago

那个是平台证书 证书真多眼花缭乱! https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay4_1.shtml

xy-peng commented 1 year ago

那个是平台证书 证书真多眼花缭乱! https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay4_1.shtml

但是并不一定需要手工设置平台证书,可以用方法一,让SDK管理的微信支付平台证书。