Gathering detailed insights and metrics for node-weixin-pay
Gathering detailed insights and metrics for node-weixin-pay
Gathering detailed insights and metrics for node-weixin-pay
Gathering detailed insights and metrics for node-weixin-pay
npm install node-weixin-pay
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
NOASSERTION License
101 Stars
70 Commits
32 Forks
6 Watchers
2 Branches
2 Contributors
Updated on Apr 25, 2025
Latest Version
0.5.1
Package Id
node-weixin-pay@0.5.1
Size
7.85 kB
NPM Version
3.10.10
Node Version
6.10.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Weixin 支付 API
支持QQ群:39287176
1$ npm install --save-exact node-weixin-pay
1、初始化对象与基本数据
1 2var nodeWeixinPay = require('node-weixin-pay'); 3var nodeWeixinConfig = require('node-weixin-config'); 4 5// 必须 6var merchant = { 7 id: process.env.MERCHANT_ID || 'id', 8 key: process.env.MERCHANT_KEY || 'key' 9}; 10var app = { 11 id: process.env.APP_ID || 'appid', 12 secret: process.env.APP_SECRET || 'appsecret', 13 token: process.env.APP_TOKEN || 'apptoken' 14}; 15 16// 证书是可选的,但在退款,红包,企业支付时需要 17 18var certificate = { 19 pkcs12: path.resolve(certPKCS12File), //格式是文件名 20 key: String(certKey) 21}; 22 23//或者 24 25var certificate = { 26 pfx: new Buffer(conf.merchant_pfx, 'base64'), //格式是文件二进制内容 27 pfxKey: conf.merchant_id 28}; 29 30//对于大部分的支付接口来说是需要config的 31var config = { 32 app: app, 33 merchant: merchant, 34 // 可选(除了退款外接口,可以不用添加) 35 certificate: certificate 36}; 37 38//校验数据的正确性 39nodeWeixinConfig.app.init(app); 40nodeWeixinConfig.merchant.init(merchant); 41 42var params = { openid: process.env.OPENID, 43 spbill_create_ip: '1.202.241.25', 44 notify_url: 'http://wx.domain.com/weixin/pay/main', 45 body: '测试支付', 46 out_trade_no: '111', 47 total_fee: '1', 48 trade_type: 'JSAPI', 49 appid: app.id, 50 mch_id: merchant.id, 51 nonce_str: 'XjUw56N8MjeCUqHCwqgiKwr2CJVgYUpe' }; 52
2、签名一个请求
1 2var sign = nodeWeixinPay.sign(merchant, params);
3、准备一个支付配置
1var id = 'id'; 2var config = nodeWeixinPay.prepay(app, merchant, id);
1、处理回调数据,所有的请求的处理结果回调
1//req.rawBody should be enabled 2var req = {rawBody: xml}; 3var res = { 4 json: function() { 5 6 } 7}; 8nodeWeixinPay.callback.notify(app, merchant, req, res, function(error, data) { 9});
1、发送统一支付请求
1nodeWeixinPay.api.order.unified(config, params, function(error, data) { 2});
2、发送订单查询请求
1var config = nodeWeixinPay.api.query(config, params, function(error, data) { 2});
3、发送订单关闭请求
1var config = nodeWeixinPay.api.close(config, params, function(error, data) { 2});
4、发送创建退款请求
1var config = nodeWeixinPay.api.refund.create(config, params, function(error, data) { 2});
5、发送退款查询请求
1var config = nodeWeixinPay.api.refund.query(config, params, function(error, data) { 2});
6、发送下载对账单请求
1var config = nodeWeixinPay.api.statements(config, params, function(error, data) { 2});
7、发送测速报告请求
1var config = nodeWeixinPay.api.report(config, params, function(error, data) { 2});
1、发起普通微信红包
1var config = nodeWeixinPay.api.redenvelope.create(config, params, function(error, data) { 2});
2、发起裂变微信红包
1var config = nodeWeixinPay.api.redenvelope.distribute(config, params, function(error, data) { 2});
3、发起红包查询
1var config = nodeWeixinPay.api.redenvelope.query(config, params, function(error, data) { 2});
1、发起企业支付
1var config = nodeWeixinPay.api.enterprise.create(config, params, function(error, data) { 2});
2、查询企业支付
1var config = nodeWeixinPay.api.enterprise.query(config, params, function(error, data) { 2});
Apache-2.0 © calidion
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 1/29 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More