sun-wechatpay-sdk
v0.0.3
Published
sun-wechatpay-sdk
Downloads
4
Readme
sun-wechatpay-sdk
sun-wechatpay-sdk
API for Node.js
微信支付 API for Node.js
- 包含以下api
- [] 申请退款
- 计划或正在开发的api
- [x] 创建支付订单
- [x] 查询退款详情
Usage
Install
npm i --save sun-wechatpay-sdk
Initialize
import WechatPay from 'sun-wechatpay-sdk';
var options = {
appid: '', // 公众号id
mch_id: "", // 商家 id
apiKey: '', // 商户平台api密匙
pfx: fs.readFileSync(path.resolve(__dirname,'./apiclient_cert.p12')) //商户平台证书
}
var wechatPay = new WechatPay(options)
refund
申请退款,具体参数参考微信官方文档
var orderData = {
transaction_id: '1555',
out_refund_no: 'refund1',
total_fee: 300,
refund_fee: 1020,
op_user_id: '1235550',
};
wechatPay.refund(orderData)
.then(result => {console.log(result)})
.catch(error => {console.log(error)})
})