hpyer / node-easywechat

EasyWeChat for Node.js
MIT License
138 stars 18 forks source link

调用微信支付v3接口时,会出现签名错误 #41

Closed zengyishou closed 1 year ago

zengyishou commented 1 year ago

const result = await client.postJson( 'https://api.mch.weixin.qq.com/v3/pay/transactions/h5', { data: { appid: this.weChatConfig.mp.app_id, mchid: this.weChatConfig.pay.mch_id, out_trade_no: orderNo, description: desc, notify_url: notify_url, amount: { total: order.amount * 100, currency: 'CNY', }, scene_info: { payer_client_ip: this.ctx.request.ip, h5_info: { type: 'Wap', }, }, }, } );

hpyer commented 1 year ago

我这边暂时没账号,无法进行调试。

一个,你要看下具体错误信息是什么,对照一下:https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay7_1.shtml#part-1

再一个,可以把请求对应的签名串 result.getInfo().headers.authorization 打印出来,再进一步排查

hpyer commented 1 year ago

感谢提交的PR,已合并并发布v3.3.6版本~ 🌹