收藏
回答

申请单次分账出错?

// 云函数入口文件

const cloud = require('wx-server-sdk')

cloud.init({

  env: cloud.DYNAMIC_CURRENT_ENV

})

// 云函数入口函数

exports.main = async (event, context) => {

  const wxContext = cloud.getWXContext(); 

  const receivers=JSON.stringify(

    [{

      "type": "MERCHANT_ID",

      "account":"1607xxxxx",

      "amount":20,

      "description": "分到商户"

      ,

  }])

  const res= await cloud.CloudPay.profitSharing({

      sub_mch_id:"160853xxx",

      nonce_str:"5K8264ILTKCH16CQ2502SI8ZNMTM67VS",

      transaction_id:event.transactionId,

      out_order_no:event.outTradeNo,

      receivers:receivers

     });

 return res;

}

VM342 WAService.js:2 Error: cloud.callFunction:fail Error: errCode: -504002 functions execute fail | errMsg: TypeError: Cannot read property 'profitSharing' of undefined

    at Runtime.exports.main [as handler] (:61536/var/user/index.js:20)

    at Runtime.handleOnce (:61536/var/runtime/node12/Runtime.engine.js:219)

    at Timeout._onTimeout (:61536/var/runtime/node12/Runtime.engine.js:56)

    at listOnTimeout (:61536/appservice/internal/timers.js:549)

    at processTimers (:61536/appservice/internal/timers.js:492) (callId: 1644667719936-0.8142589655852928) (trace: 20:8:39 start->20:8:40 system error (Error: errCode: -504002 functions execute fail | errMsg: TypeError: Cannot read property 'profitSharing' of undefined

    at Runtime.exports.main [as handler] (:61536/var/user/index.js:20)

    at Runtime.handleOnce (:61536/var/runtime/node12/Runtime.engine.js:219)

    at Timeout._onTimeout (:61536/var/runtime/node12/Runtime.engine.js:56)

    at listOnTimeout (:61536/appservice/internal/timers.js:549)

    at processTimers (:61536/appservice/internal/timers.js:492)), abort)

    at I (VM342 WAService.js:2)

    at VM342 WAService.js:2(env: Windows,mp,1.05.2201240; lib: 2.16.0)

errorReport @ VM342 WAService.js:2

thirdErrorReport @ VM342 WAService.js:2

(anonymous) @ VM342 WAService.js:2

I @ VM342 WAService.js:2

o @ VM342 WAService.js:2

(anonymous) @ VM342 WAService.js:2

value @ VM342 WAService.js:2

o @ VM342 WAService.js:2

(anonymous) @ VM342 WAService.js:2

回答关注问题邀请回答
收藏

1 个回答

  • Mr.Zhao
    Mr.Zhao
    2022-02-12

    2022-02-12
    有用 1
    回复 1
    • 平安一生
      平安一生
      2022-02-14
      原来cloudPay要首字母要小写
      2022-02-14
      回复
登录 后发表内容