关于微信小程序的支付开发 40013错误,微信支付开发文档教程

来源:未知 浏览 141次 时间 2021-06-10 00:51

微信小程序支付终于踩完坑了发现里面坑挺大的现在发个贴品牌推广计划现在发个贴希望以后入坑的同学可以看一下 : 
https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_4&index=2 
业务流程在这里大家看文档的时候可以看到。第一个坑获取用户的openid参数一定要拼在url连接上否则会报{"errcode":40013,"errmsg":"invalid appid, hints: [ req_id: iil1ba0504ns86 ]"}错误

onLoad: function () { var that = this wx.login({ success: function (res) { if (res.code) { //发起网络请求 wx.request({ url: 'https://api.weixin.qq.com/sns/jscode2session?appid=wxaacf22345345cfc7162fe3&secret=83ebd41c3e6f34a49b3a34578063434548ff3f71&js_code=' + res.code + '&grant_type=authorization_code', method: "POST", success: function (res) { that.setData({ openid: res.data.openid }) } }) } else { console.log('获取用户登录态失败!' + res.errMsg)  

标签: successampappidfunction