egg-tenpay-zengxiaohui
v1.0.5
Published
egg plugin for tenpay-zengxiaohui
Downloads
3
Maintainers
Readme
egg-tenpay-zengxiaohui 基于egg-tenpay优化
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.