收藏
回答

请教云函数调用微信支付订单查询?

请教云函数调用微信支付订单查询

请教各位大神

// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init()
// 云函数入口函数
exports.main = async (event, context) => {
  const wxContext = cloud.getWXContext()
  var cdcd =  cloud.CloudPay.queryOrder({
    "sub_mch_id" : '1579010231',
    "out_trade_no" : event._id,
    "nonce_str" : new Date().getTime(),
  })
  return {
    event,
  }
}


回调结果:

Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID 990d0ef2-4e89-11eb-b1d3-525400a8c4bb, cloud function service error code -504002, error message TypeError: Cannot read property 'queryOrder' of undefined
    at Runtime.exports.main [as handler] (:12220/var/user/index.js:9)
    at Runtime.handleOnce (:12220/var/runtime/node10/Runtime.engine.js:214)
    at Timeout.setTimeout [as _onTimeout] (:12220/var/runtime/node10/Runtime.engine.js:54)
    at ontimeout (:12220/appservice/timers.js:436)
    at tryOnTimeout (:12220/appservice/timers.js:300)
    at listOnTimeout (:12220/appservice/timers.js:263)
    at Timer.processTimers (:12220/appservice/timers.js:223); at cloud.callFunction api; 
    at new u (WAService.js:1)
    at d (WAService.js:1)
    at f (WAService.js:1)
    at Function.success (WAService.js:1)
    at WAService.js:1
    at C (WAService.js:1)
    at i. (WAService.js:1)
    at i.emit (WAService.js:1)
    at Rs (WAService.js:1)
    at WAService.js:1

最后一次编辑于  2021-01-04
回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容
问题标签