let req = {
functionName: 'webbrefundcb',
envId: envId,
sub_mch_id: borderwx.sub_mchid,
nonce_str: random, // 需要生成
transaction_id: borderwx.transaction_id,
out_trade_no: borderwx.out_trade_no,
out_refund_no: borderwx.out_trade_no + 'PB',
total_fee: borderwx.amount.total,
refund_fee: borderwx.amount.payer_total,
refund_desc: 'Teem 商户订单退款'
}
console.log('退款请求参数 : ', req)
await cloud.cloudPay.refund(req).then(res => {
console.log('请求退款结果 : ', res)
return {
result: true,
msg: '请求退款成功'
}
}).catch(err => {
console.log('请求退款出错 : ', err)
return {
result: false,
msg: '请求退款失败'
}
})
返回:
请求退款结果 :
couponRefundFeeList: []
couponRefundIdList: []
couponTypeList: []
errCode: 0
errMsg: "cloudPay.refund:ok"
returnCode: "FAIL"
returnMsg: "sub_mch_id is not bound."
__proto__: Object
我猜测是因为这个订单是服务商订单(我们自己作为服务商,替子商户发起的订单),而云开发的refund函数目前就直接写死了参数(官方作为服务商(商户号:1800008281)),希望将参数开放出来,支持我们普通服务商的订单退款。