在使用微信支付退款功能的时候请求退款API报400,已经把apiclient_cert.p12 安装在本地,并且放在项目根目录下,可以通过根目录访问到。
报错信息
{
"message":"Request failed with status code 400",
"name":"Error",
"stack":"Error: Request failed with status code 400
at createError (/Users/tang/Documents/myProject/koala/koala-server/node_modules/_axios@0.19.2@axios/lib/core/createError.js:16:15)
at settle (/Users/tang/Documents/myProject/koala/koala-server/node_modules/_axios@0.19.2@axios/lib/core/settle.js:17:12)
at IncomingMessage.handleStreamEnd (/Users/tang/Documents/myProject/koala/koala-server/node_modules/_axios@0.19.2@axios/lib/adapters/http.js:236:11)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1220:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)",
"config":{
"url":"https://api.mch.weixin.qq.com/secapi/pay/refund",
"method":"post",
"data":"<xml><appid></appid><mch_id></mch_id><nonce_str></nonce_str><transaction_id></transaction_id><out_refund_no></out_refund_no><total_fee></total_fee><refund_fee></refund_fee><refund_desc></refund_desc><notify_url></notify_url><cert_path></cert_path><sign></sign></xml>",
"headers":{
"Accept":"application/json, text/plain, */*",
"Content-Type":"text/xml;charset=utf-8",
"User-Agent":"axios/0.19.2",
"Content-Length":545
},
"transformRequest":[
null
],
"transformResponse":[
null
],
"timeout":0,
"xsrfCookieName":"XSRF-TOKEN",
"xsrfHeaderName":"X-XSRF-TOKEN",
"maxContentLength":-1
}
}
我这边也是提示400 怎么回事啊
你好,麻烦提供一下完整退款参数。
1,是你的请求语法没有按照文档来。语法错误。
2,是你的证书请求有问题。麻烦进行核实。