egg-tenpay
v1.0.1
Published
egg plugin for tenpay
Downloads
73
Readme
egg-tenpay
Install
$ npm i egg-tenpay --save
Usage
// {app_root}/config/plugin.js
exports.tenpay = {
enable: true,
package: 'egg-tenpay'
};
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.