bug?
import WechatPayment from 'wechat-payment-node'; let options = { appid: 'your app id', mch_id: 'your merchant id', apiKey: 'your app key (partner key)', //微信商户平台API密钥 notify_url: 'your notify url', trade_type: 'APP', //APP, JSAPI, NATIVE etc. pfx: fs.readFileSync('./apiclient_cert.p12'), //微信商户平台证书 (optional,部分API需要使用) }; let wechatPaymentInstance = new WechatPayment(options);
WechatPayment not a constructor
我的 test 运行成功,可不可以详细说明一下问题
我也遇到这个问题了,WechatPayment not a constructor,报错的语句就是 let wechatPaymentInstance = new WechatPayment(options);
我的也遇到这个问题了,可能是node版本低的原因。我的是6.9.5。看别的issue,写着作者用ES7的标准写的这个。
如果不使用babel,node并不支持import语法,可以用
const { default: WechatPayment } = require('wechat-payment-node')
let pay = new WechatPayment(payOptions)