Skip to content

tinfinite/weChatPay

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

weChatPay

基于es6的微信支付for Nodejs

初始化

import Payment form './payment';

let initConfig = {

  partnerKey: '<partnerKey>',

  appid: '<appid>',

  mch_id: '<mch_id>',

  notify_url: '<notify_url>'

}

付个钱

let order = {   body:<商品的描述>,

  attach:<商品的附属描述>,

  total_fee:<商品的费用>,

  spbill_create_ip: <终端的ip>,

  trade_type: <交易类型>

}

let payParams = await payment.getReadyPayParams(order);

  • 注意:await一定要处于try/catche中。

接收微信付款确认请求

app.use('<notify_url>', async (req,res,next) =>{

let body = await payment.getWcPayConfirmRequest(req);

});

Packages

No packages published

Languages

  • JavaScript 100.0%