tvrcgo / weixin-pay

微信支付 Nodejs SDK
MIT License
916 stars 241 forks source link

这个项目现在还能用吗? #32

Closed cos800 closed 7 years ago

cos800 commented 7 years ago

我的代码是这样:

        wxpay.createUnifiedOrder(orderInfo, (err,rst)=>{
            console.log(err);
            console.log(rst);
        });

然后输出错误:

TypeError: Cannot read property 'toString' of undefined
    at Parser.exports.Parser.Parser.parseString (/Users/cos800/projxxx/node_modules/xml2js/lib/xml2js.js:497:18)
    at Parser.parseString (/Users/cos800/projxxx/node_modules/xml2js/lib/xml2js.js:7:59)
    at Object.exports.parseXML (/Users/cos800/projxxx/node_modules/weixin-pay/lib/util.js:11:9)
    at Request._callback (/Users/cos800/projxxx/node_modules/weixin-pay/lib/wxpay.js:75:8)
    at self.callback (/Users/cos800/projxxx/node_modules/request/request.js:188:22)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at Request.start (/Users/cos800/projxxx/node_modules/request/request.js:757:10)
    at Request.write (/Users/cos800/projxxx/node_modules/request/request.js:1511:10)
    at end (/Users/cos800/projxxx/node_modules/request/request.js:552:18)
    at Immediate.<anonymous> (/Users/cos800/projxxx/node_modules/request/request.js:581:7)
    at runCallback (timers.js:570:20)
    at tryOnImmediate (timers.js:550:5)
    at processImmediate [as _immediateCallback] (timers.js:529:5)
undefined
cos800 commented 7 years ago

我是在thinkjs框架里使用weixin-pay来着~

LincolnBurrows commented 7 years ago

统一下单接口没问题,应该是你的orderInfo配置的有问题吧

cos800 commented 7 years ago

应该是的,但是这个错误提示真让人无从下手啊。

LincolnBurrows commented 7 years ago

把orderInfo贴上来

cos800 commented 7 years ago

我已经改用 wechat-pay https://github.com/supersheep/wechat-pay 算是解决了~