diff --git a/lib/wxpay.js b/lib/wxpay.js index 969ac13..f2967cb 100644 --- a/lib/wxpay.js +++ b/lib/wxpay.js @@ -76,6 +76,26 @@ WXPay.mix('createUnifiedOrder', function(opts, fn){ }); }); +WXPay.mix('cardPay', function(opts, fn){ + + opts.nonce_str = opts.nonce_str || util.generateNonceString(); + util.mix(opts, this.wxpayID); + opts.sign = this.sign(opts); + + request({ + url: "https://api.mch.weixin.qq.com/pay/micropay", + method: 'POST', + body: util.buildXML(opts), + agentOptions: { + pfx: this.options.pfx, + passphrase: this.options.mch_id + } + }, function(err, response, body){ + console.log(body); + util.parseXML(body, fn); + }); +}); + WXPay.mix('getBrandWCPayRequestParams', function(order, fn){ order.trade_type = "JSAPI";