收藏
回答

sub_mch_id与sub_appid不匹配?

payMoney() {
///开始支付
    wx.showLoading({
      title'加载...',
    })
    //console.log('app.globalData.user.vid,', app.globalData, app.globalData.user.vid)
    wx.cloud.callFunction({
      name'createOrder',
      data: {
        vid: app.globalData.user.vid,
        totalFeethis.data.totalFee,


      }
    }).then(res => {
      wx.hideLoading()
      console.log('createorder :',res.result, res)
      this.unifiedOrder(res.result)
    }).catch(err => {
      wx.hideLoading()
    })


  },


  unifiedOrder(data) {
//统一下单
    console.log('unifiedOrder data',data)
    wx.showLoading({


      title'加载...',
    })
    wx.cloud.callFunction({
      name'unifiedOrder',
      data: data
    }).then(res => {
      //同一下单预处理order
      console.log('res.result.payment',res)
      wx.hideLoading()
      this.requestPayment(res.result.payment)
    }).catch(err => {
      console.log(err)
      wx.hideLoading()
    })
  },
  requestPayment(payment) {
    let that = this
    wx.requestPayment({
      ...payment,
      success(res) {
        console.log('pay success', res)
        wx.showModal({
          content'打赏成功!',
          showCancelfalse,
          successres2 => {
            if (res2.confirm) {
              //console.log('app.globalData.user', app.globalData.user)
              app.globalData.user.coin = app.globalData.user.coin + parseInt(that.data.totalFee / 100)
              wx.redirectTo({
                url`/pages/${that.data.page}/${that.data.page}`,
              })
            }
          }
        })
      },
      fail(err) {
        console.error('pay fail', err)
        wx.showModal({


          content'打赏失败!',
          showCancelfalse,


        })
      }
    })
  },

//////////
提示{returnCode"FAIL"returnMsg"sub_mch_id与sub_appid不匹配"errCode0errMsg"cloudPay.unifiedOrder:ok"}
基于腾讯云开发的,
回答关注问题邀请回答
收藏

2 个回答

  • Memory
    Memory
    2023-12-22

    云开发要去授权才行

    2023-12-22
    有用
    回复 4
    • C.ROBBER🥤
      C.ROBBER🥤
      2023-12-22
      有是授权啊
      2023-12-22
      回复
    • Memory
      Memory
      2023-12-22回复C.ROBBER🥤
      你的绑定状态是没有绑定的
      2023-12-22
      回复
    • 云淡风清 hello world
      云淡风清 hello world
      星期一 10:41
      这个绑定授权发起后绑定商户失败怎么解决的?
      星期一 10:41
      回复
    • Memory
      Memory
      星期一 11:54回复云淡风清 hello world
      报错什么
      星期一 11:54
      回复
  • 路人
    路人
    2023-12-22

    https://kf.qq.com/faq/190715yaYnYv1907153mmIbA.html

    2023-12-22
    有用
    回复 3
    • C.ROBBER🥤
      C.ROBBER🥤
      2023-12-22
      你好好,我是个体户,不能使用服务商功能吗?
      2023-12-22
      回复
    • 路人
      路人
      2023-12-22回复C.ROBBER🥤
      不太懂云开发,确定已经绑定,并且接口没调用错的话,按楼上说的操作吧
      2023-12-22
      回复
    • C.ROBBER🥤
      C.ROBBER🥤
      2023-12-22
      谢谢
      2023-12-22
      回复
登录 后发表内容