请求授权
更新时间:2024.12.27向用户发起授权使用收款二维码的请求。
# 接口说明
接口名称: "wx.authorize"
接口文档: 《wx.authorize(Object object) (opens new window)》
# 请求参数
说明: 需要用户授权使用收款二维码时,对应的参数是scope.receiptQrCode
# 示例代码
1// 可以通过 wx.getSetting 先查询一下用户是否授权了 " scope.receiptQrCode " 这个 scope2wx.getSetting({3 success(res) {4 if (!res.authSetting['scope.receiptQrCode']){5 wx.authorize({6 scope: 'scope.receiptQrCode',7 success () {8 // 用户已经同意小程序使用收款二维码,后续他人向此用户付款时,小程序可以调用 scope.receiptQrCode9接口调起支付10 }11 })12 }13 }14})
文档是否有帮助