yangfuhe / node-wxpay

微信支付APIv3 for nodejs
168 stars 30 forks source link

throw new Error('获取证书列表失败') #9

Open fabrietech opened 10 months ago

fabrietech commented 10 months ago

const Payment = require("wxpay-v3"); const payment = new Payment({ appid: "xxxx", mchid: "xxx", private_key: require("fs") .readFileSync("./cert/apiclient_key.pem") .toString(), //或者直接复制证书文件内容 serial_no: "3xxxxxxxC0DFDB7CF67B901A5A5746A", apiv3_private_key: "xxxxxx", notify_url: "https://f.tuoyal.com/beta-api/version", }); // const config = { // mchid: '1633213487', // 商户号 // serial: '36DA2A3BF839A4FC0C0DFDB7CF67B901A5A5746A', // 商户API证书序列号 // privateKey: readFileSync('./cert/apiclient_key.pem'), // 商户API私钥 // publicKey: readFileSync('./cert/apiclient_cert.pem'), // 微信支付平台公钥 // appid: 'wx7331e7f65737fd9a', // 微信支付应用ID // };

let test = async () => { let result = await payment.app({ description: "点存云-测试支付", out_trade_no: Date.now().toString(), amount: { total: 1, }, }); console.log("result", result); };

/Users/liuzukuan/Desktop/wechat/node_modules/wxpay-v3/lib/index.js:231 throw new Error('获取证书列表失败') ^

Error: 获取证书列表失败 at Payment.decodeCertificates (/Users/liuzukuan/Desktop/wechat/node_modules/wxpay-v3/lib/index.js:231:19) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

panghongye commented 1 month ago

解决了吗 我也是