goPay(){
wx.cloud.callFunction({
name: 'demoPay',
success: res => {
console.log('获取支付参数成功',res)
const payment = res.result.payment
wx.requestPayment({
...payment,
success (res) {
console.log('pay success', res)
},
fail (res) {
console.error('pay fail', err)
}
})
},
fail: console.error,
})
},
const cloud = require('wx-server-sdk')
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV
})
exports.main = async (event, context) => {
const res = await cloud.cloudPay.unifiedOrder({
"body" : "尚狐网站测试支付001",
"outTradeNo" : "11111111122222222233333333344444",
"spbillCreateIp" : "127.0.0.1",
"subMchId" : "1287651501",
"totalFee" : 2,
"envId": "wxxcxsf",
"functionName":'echo'
})
return res
}
{errMsg: "cloud.callFunction:ok", result: {…}, requestID: "66c2674d-bc2f-11ea-941e-525400f4c87f"}
errMsg: "cloud.callFunction:ok"
requestID: "66c2674d-bc2f-11ea-941e-525400f4c87f"
result:
errCode: 0
errMsg: "cloudPay.unifiedOrder:ok"
payment: {timeStamp: "1593672236", nonceStr: "", package: "prepay_id=", signType: "MD5", paySign: "5040A7C5DF5C92A77662845550FAE3A4"}
returnCode: "FAIL"
returnMsg: "受理关系不存在"
__proto__: Object
__proto__: Object
商户和子商户没有绑定的关系,才会报这个错误。确认绑定关系是否存在问题。谢谢。