egg-tenpay-zengxiaohui

1.0.5 • Public • Published

egg-tenpay-zengxiaohui 基于egg-tenpay优化

NPM version build status Test coverage David deps Known Vulnerabilities npm download

egg plugin for tenpay

Install

$ npm i egg-tenpay-zengxiaohui --save

Usage

// {app_root}/config/plugin.js
exports.tenpay = {
  enable: true,
  package: 'egg-tenpay-zengxiaohui'
};

Configuration

//参考 [tenpay](https://github.com/befinal/node-tenpay)配置
// {app_root}/config/config.default.js
exports.tenpay = {
  client: {
    appid: 'appid',
    mchid: 'mchid',
    partnerKey: 'partnerKey',
    notify_url: 'notify_url',
    sandbox: true // sandbox是否沙箱
  }
};

see config/config.default.js for more detail.

Example

// api调用
const result = await app.tenpay.getPayParams({
  out_trade_no: '商户内部订单号',
  body: '商品简单描述',
  total_fee: '订单金额(分)',
  openid: '付款用户的openid'
});

// 中间件
// router.js
router.post('/notify',app.middleware.tenpay('pay', app),controller.home.notify);

Questions & Suggestions

Please open an issue here.

License

MIT

Package Sidebar

Install

npm i egg-tenpay-zengxiaohui

Weekly Downloads

0

Version

1.0.5

License

MIT

Unpacked Size

5.72 kB

Total Files

6

Last publish

Collaborators

  • zengxiaohui2019