Gathering detailed insights and metrics for @sigodenjs/wechatpay
Gathering detailed insights and metrics for @sigodenjs/wechatpay
npm install @sigodenjs/wechatpay
Typescript
Module System
Node Version
NPM Version
74
Supply Chain
93.7
Quality
71.2
Maintenance
50
Vulnerability
97.3
License
TypeScript (99.91%)
JavaScript (0.09%)
Total Downloads
8,055
Last Day
1
Last Week
6
Last Month
27
Last Year
873
118 Stars
39 Commits
24 Forks
8 Watching
2 Branches
2 Contributors
Minified
Minified + Gzipped
Latest Version
2.1.1
Package Id
@sigodenjs/wechatpay@2.1.1
Size
46.23 kB
NPM Version
6.4.1
Node Version
10.15.3
Publised On
10 Jun 2019
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
-50%
6
Compared to previous week
Last month
50%
27
Compared to previous month
Last year
-24.3%
873
Compared to previous year
4
微信支付 SDK,支持刷卡支付、公众号支付、扫码支付、APP 支付、H5 支付,以及优惠券,红包,企业付款,微信代扣
1const path = require("path"); 2const fs = require("fs"); 3const { 4 PubPay, 5 RequestError, 6 CommunicationError, 7 utils: { getXMLBody } 8} = require("@sigodenjs/wechatpay"); 9 10const pay = new PubPay({ 11 appId: "wxb80e5bddb2d804f3", 12 key: "6Q9VX4N3WTBM9G9XBL7H1L9PB9ANHLY7", 13 mchId: "1434712502", 14 pfx: fs.readFileSync(path.resolve(__dirname, "cert.p12")) 15}); 16 17// 调用统一下单接口 18pay 19 .unifiedOrder({ 20 body: "腾讯充值中心-QQ会员充值", 21 out_trade_no: "1217752501201407033233368018", 22 total_fee: 888, 23 spbill_create_ip: "8.8.8.8", 24 notify_url: "https://example.com/wechatpay/notify", 25 trade_type: "JSAPI", 26 openid: "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o" 27 }) 28 .then(res => { 29 if (!pay.verifySign(res)) { 30 // 签名校验失败 31 throw new Error("签名校验失败"); 32 } 33 if (res.result_code === "FAIL") { 34 console.log(res.err_code, res.err_code_des); 35 } else { 36 console.log(res.prepay_id); 37 } 38 }) 39 .catch(err => { 40 if (err instanceof RequestError) { 41 // 请求错误 42 } else if (err instanceof CommunicationError) { 43 // return_code = FAIL 44 } 45 }); 46 47// 支付结果通知 48router.post("/wechatpay/notify", (req, res) => { 49 const options = { 50 length: req.headers["content-length"], 51 limit: "1mb", 52 encoding: "utf8" 53 }; 54 getXMLBody(req, options).then(data => { 55 pay 56 .payNotify(data, async parsedData => { 57 if (!pay.verifySign(parsedData)) { 58 // 签名校验失败 59 } 60 if (parsedData.result_code === "FAIL") { 61 // 业务逻辑失败 62 } 63 // ... 64 return { 65 return_code: "SUCCESS", 66 return_msg: "OK" 67 }; 68 }) 69 .then(returnData => { 70 res.set("Content-Type", "application/xml; charset=utf-8"); 71 res.end(returnData); 72 }); 73 }); 74});
如果你只使用了某一项支付,请使用业务类。但如果涉及多种支付,使用综合类更便捷。
Copyright (c) 2018 sigoden
Licensed under the MIT license.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-01-06
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