安装
npm install yu-wxapi
导入
const wx = require('yu-wxapi')
初始化
wx.init(appid, secret, mchid, privateKeyPath, serial_no, apiV3)
调用方法
await wx.loginForApplet(code)
await wx.getUserPhoneNumber(code)
await wx.orderPayByJSAPI(description, amountTotal, openid, notify_url = '', support_fapiao = false)
await wx.orderPayByH5(description, amountTotal, payer_client_ip, notify_url = '', support_fapiao = false)
await wx.orderPayByNative(description, amountTotal, notify_url = '', support_fapiao = false)
await wx.orderQuery(out_trade_no)
await wx.refund(out_trade_no, reason, refund, total, notify_url = null)
await wx.refundQuery(out_trade_no)
wx.refundNotify(refundData)
wx.payNotify(payData)