尸子
尸子
  • 发布:2019-05-18 11:26
  • 更新:2019-05-18 11:26
  • 阅读:3191

微信支付

分类:uni-app

uniapp唤起微信支付:
前端调用API:
const datas = res.data.body
const orderInfo = JSON.stringify(datas)
console.log(orderInfo)
//微信支付
uni.requestPayment({
provider:'wxpay',
orderInfo,
success(res) {
console.log(res)
console.log('唤起支付成功')
that.newshow = 0
that[member.mylevel] = mid
that.init()
},
fail(er) {
console.log('唤起支付失败')
console.log(JSON.stringify(er))
that.newshow = 0
}
})

datas 是服务器返回的订单数据,其中包含字段参考:
微信支付开发文档:https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_12&index=2
注意字段一定要跟开发文档上的一样,区分大小写,一般来说支付不成功都是后台的问题,前端只是调用API ^-^
支持真机调试,使用自定义基座即可!

0 关注 分享

要回复文章请先登录注册