uniapp微信小程序唤起微信支付
var timeStr = String(new Date().getTime()); var signStr = "appId=" + res.data.info.appid + "&nonceStr=" + res.data.info.nonce_str + "&package=prepay_id=" + res.data.info.prepay_id + "&signType=MD5&timeStamp=" + timeStr + "&key=" + res.data.info.key let paySign = that.$md5(signStr) uni.showLoading({}) //拉起支付加载提示 uni.hideLoading() uni.requestPayment({ //下面参数为必传 appId: res.data.info.appid, //小程序Appid nonceStr: res.data.info.nonce_str, timeStamp: timeStr, //创建订单时间戳 package: "prepay_id=" + res.data.info.prepay_id, signType: "MD5", paySign: paySign, // 后台支付签名返回 success(res) { uni.showToast({ title: "支付成功", icon: "none" }); }, fail(err) { console.log('支付失败') } })View Code
得到AppID相关数据,调用该代码就行了。