。
在统一下单参数加上attach参数会报签名错误,请问统一下单如何添加attach参数?添加的参数如下: map.put("attach", "购买虚拟商品"); 统一下单接口返回如下: [图片] 去掉attach参数则接口调用正常,请问下是什么原因导致的,要添加attach应该如何操作,谢谢!
2021-04-16[图片]
在【微信支付商家助手】的【收款详情】中,通过云函数获取支付参数时,怎么获取用户提交订单中的手机号?大佬好! 想要在商户收款详情中添加的手机号,效果如下: [图片] 用的是云函数获取参数: exports.main = async (event, context) => { const wxContext = cloud.getWXContext() //let orderId = event.currentTarget.dataset.orderid; let { orderid, totalPrice, phone, } = event; //3,初始化支付 const api = tenpay.init(config); //4获取支付参数 let result = await api.getPayParams({ // out_trade_no: '13796590155015090', out_trade_no: orderid, body: '产品名称', //body: phone, // phone: uphone, phone: phone, //total_fee: 1, //订单金额(分), total_fee: totalPrice*100, openid: wxContext.OPENID //付款用户的openid }); return result; } 在其js文件中传递用户填写的手机号: wx.cloud.callFunction({ name: "getOpenid", data: { orderid: orderId, // totalPrice: 0.01, totalPrice: totalPrice003, phone: uphone, }, success(res) { //var that = this; console.log("提交成功101", res.result) that.getOpenid(res.result); console.log("订单上传001", res.result); }, fail(res) { console.log("提交失败101", res) }, }), 尝试多次都无法获取。。。 请教大佬!!! 谢大佬
2020-08-05把wx.request({})放到 wx.cloud.callFunction({})外面,就不会报错; 但是是在支付完成前就已经传递参数到后台url了 button: function) { let orderId = Date.now(); wx.cloud.callFunction({ name: "getOpenid" data: { orderid: orderId, totalPrice: 0.1 }, success(res) { console.log("提交成功101", res.result) that.getOpenid(res.result) }, fail(res) { console.log("提交失败101", res) }, }) var uphone = wx.getStorageSync('uphone'); wx.request({ url: app.globalData.baseUrl + '/buyer/order/create' method: "POST" header: { "Content-Type": "application/x-www-form-urlencoded" }, data: { openid: app.globalData.openid, name: app.globalData.userInfo.nickName phone: uphone, }, success: function (res) { console.log("支付成功10001:", res.data) if (res && res.data && res.data.data) { // 支付方式关闭动画 that.animation.translate(, 285).step(); that.setData({ animationData: that.animation.export() }); that.setData({ maskFlag: true }); wx.setStorageSync('cart', "" wx.switchTab({ url: '../index/index' }) } else { // 支付方式关闭动画 that.animation.translate(, 285).step(); that.setData({ animationData: that.animation.export() }); that.setData({ maskFlag: true }); } } }) }, getOpenid(payData) { //console.log("入口支付成功11", res) wx.requestPayment({ timeStamp: payData.timeStamp, nonceStr: payData.nonceStr, package: payData.package, signType: 'MD5', paySign: payData.paySign, success(res) { console.log("入口支付成功11", res.data) }, fail(res) { console.log("入口支付失败11", res) } }) }
怎么在小程序支付完成后,传递数据给url后台?支付可以正常运行,但是无法传递数据url到后台 button: function(e) { let orderId = Date.now(); wx.cloud.callFunction({ name: "getOpenid" data: { orderid: orderId, totalPrice: 0.1 }, success(res) { console.log("提交成功101", res.result) that.getOpenid(res.result) }, fail(res) { console.log("提交失败101", res) }, complete: function () { var uphone = wx.getStorageSync('uphone'); wx.request({ url: app.globalData.baseUrl + '/buyer/order/create' method: "POST" header: { "Content-Type": "application/x-www-form-urlencoded" }, data: { openid: app.globalData.openid, name: app.globalData.userInfo.nickName phone: uphone, }, success: function (res) { console.log("支付成功10001:", res.data) if (res && res.data && res.data.data) { // 支付方式关闭动画 that.animation.translate(, 285).step(); that.setData({ animationData: that.animation.export() }); that.setData({ maskFlag: true }); wx.setStorageSync('cart', "" wx.switchTab({ url: '../index/index' }) } else { // 支付方式关闭动画 that.animation.translate(, 285).step(); that.setData({ animationData: that.animation.export() }); that.setData({ maskFlag: true }); } } }) } }) }, getOpenid(payData) { //console.log("入口支付成功11", res) wx.requestPayment({ timeStamp: payData.timeStamp, nonceStr: payData.nonceStr, package: payData.package, signType: 'MD5', paySign: payData.paySign, success(res) { console.log("入口支付成功11", res.data) }, fail(res) { console.log("入口支付失败11", res) } }) } [图片] 求大佬
2020-01-15