callPayMent() {
wx.request({
url: 'https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi',
data: {
"mchid": "1639047852", //商户号
"out_trade_no": "dd20230320xx001", //商户系统内部订单号
"appid": "wx00c3f080aa876909", //小程序ID
"description": "测试订单A", //商品描述
"notify_url": "https://www.weixin.qq.com/wxpay/pay.php", //支付结果通知的回调地址
"amount": {
"total": 1, //订单总金额
"currency": "CNY" //货币类型
},
"payer": {
"openid": "oGx5X5DrIVZVGto7PN8kgRW5A4Y4" //用户(支付者)openid
}
},
header: {
'content-type': 'application/json' // 默认值
},
method:"POST", //请求方式
success (res) {
console.log(res.data)
}
})
},
报错信息:
缺少请求头https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay4_0.shtml#part-3