学习云开发实现支付,一直报错404011码。
看了一圈好多类似的问题,依旧无法处理。
//云开发实现支付
const cloud = require('wx-server-sdk')
cloud.init()
//1,引入支付的三方依赖
const tenpay = require('tenpay');
//2,配置支付信息
const config = {
appid: 'wx****2c80',
mchid: '129***901',
partnerKey: 'u2*************me1',
notify_url: 'https://mp.weixin.qq.com',
spbill_create_ip: '127.0.0.1' //这里填这个就可以
};
exports.main = async(event, context) => {
const wxContext = cloud.getWXContext()
let {
orderid,
money
} = event;
//3,初始化支付
const api = tenpay.init(config);
let result = await api.getPayParams({
out_trade_no: orderid,
body: '商品简单描述',
total_fee: money, //订单金额(分),
openid: wxContext.OPENID //付款用户的openid
});
return result;
}
WAService.js:1 Uncaught (in promise) Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID 8ffd5110-0ae1-11eb-8047-525400979946, cloud function service error code -504002, error message Error: PARAM_ERROR
老哥解决了吗?
给出你的云函数代码
const cloud = require('wx-server-sdk')
cloud.init()
//1,引入支付的三方依赖
const tenpay = require('tenpay');
//2,配置支付信息
const config = {
appid: 'wx****2c80',
mchid: '129***901',
partnerKey: 'u2*************me1',
notify_url: 'https://mp.weixin.qq.com',
spbill_create_ip: '127.0.0.1' //这里填这个就可以
};
exports.main = async(event, context) => {
const wxContext = cloud.getWXContext()
let {
orderid,
money
} = event;
//3,初始化支付
const api = tenpay.init(config);
let result = await api.getPayParams({
out_trade_no: orderid,
body: '商品简单描述',
total_fee: money, //订单金额(分),
openid: wxContext.OPENID //付款用户的openid
});
return result;
}