sun-wechatpay-sdk

0.0.3 • Public • Published

sun-wechatpay-sdk

sun-wechatpay-sdk API for Node.js

微信支付 API for Node.js

  • 包含以下api
    • [] 申请退款
  • 计划或正在开发的api
    • 创建支付订单
    • 查询退款详情

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)})
})

Readme

Keywords

none

Package Sidebar

Install

npm i sun-wechatpay-sdk

Weekly Downloads

0

Version

0.0.3

License

ISC

Last publish

Collaborators

  • evanliu