Installations
npm install @axolo/node-wechat-pay
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=14.0.0
Node Version
15.10.0
NPM Version
7.5.3
Score
70.7
Supply Chain
98.3
Quality
75.6
Maintenance
50
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
axolo
Download Statistics
Total Downloads
2,368
Last Day
1
Last Week
4
Last Month
24
Last Year
329
GitHub Statistics
1 Stars
19 Commits
1 Forks
3 Watching
2 Branches
1 Contributors
Bundle Size
21.01 kB
Minified
7.68 kB
Minified + Gzipped
Package Meta Information
Latest Version
0.3.5
Package Id
@axolo/node-wechat-pay@0.3.5
Unpacked Size
14.20 kB
Size
4.64 kB
File Count
8
NPM Version
7.5.3
Node Version
15.10.0
Total Downloads
Cumulative downloads
Total Downloads
2,368
Last day
0%
1
Compared to previous day
Last week
-55.6%
4
Compared to previous week
Last month
-48.9%
24
Compared to previous month
Last year
-20.3%
329
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
2
node-wechat
Wechat Pay v3 Node.js SDK.
Install
1yarn add @axolo/node-wechat-pay
API
For more usage please issue.
constructor(config = {})
params
config | required | description |
---|---|---|
appId | yes | wechat pay appid |
mchId | yes | wechat pay mchid |
mchCert | yes | wehcat pay merchant certificate |
mchCertKey | yes | wehcat pay merchant certificate private key |
mchCertSn | yes | wechat pay merchant certificate serial number |
apiV3Key | yes | wechat pay api v3 secret key |
notifyUrl | yes | Wechat Pay Notify callback url |
notifySuccess | Wechat Pay Notify need response { code: 'SUCCESS' } event types | |
platformCert | wehcat pay platform certificate | |
currency | default is CNY | |
appType | mp = miniprogram | |
http | HTTP Client, default is built-in axios instance | |
error | class of Error, default is WechatPayError | |
logger | function of logger, default is console | |
cache | default is {} , it is reserved |
return
Object
of WechatPay
Node.js SDK instance.
http(config)
http client for request wechat pay API.
params
param | required | description |
---|---|---|
config | yes | config of axios |
return
Promise
of wechat pay result as axios response.
nonceStr()
return
String
of nonce_str
, random string.
timeStamp()
return
String
of timestamp
, unix timestamp second.
payRequest(payPackage, signType = 'RSA')
params
param | required | description |
---|---|---|
payPackage | yes | package of wechat pay, like prepay_id=*** |
signType | signType of wechat pay, default is RSA |
return
Object
of wechat pay payment request
prop | description |
---|---|
appId | wehcat pay appid |
timeStamp | timestamp, seconds |
nonceStr | nonce string |
package | package of wechat pay, like prepay_id=*** |
paySign | base64 signature |
signType | signType of wechat pay, like RSA |
notify(data)
params
param | required | description |
---|---|---|
data | yes | Wechat Pay Notify request body |
return
Object
of Wechat Pay Notify decrypt resource with response suggestion.
prop | description |
---|---|
resource | decrytp resource |
response | response suggestion. like { code: 'SUCCESS' } |
Example
1const fs = require('fs'); 2const WechatPay = require('@axolo/node-wechat-pay'); 3 4const wechatPay = new WechatPay({ 5 appType: 'mp', 6 appId: 'wechat_pay_appid', 7 mchId: 'wechat_pay_mchid', 8 mchCertSn: 'wechat_pay_mch_cert_serial_no', 9 mchCertKey: fs.readFileSync('wehcat_pay_mch_cert_private_key.pem'), 10 mchCert: fs.readFileSync('wehcat_pay_mch_cert.pem'), 11 apiV3Key: 'wechat_pay_api_v3_secret', 12 notifyUrl: 'https://url-of-wechat-pay-notify', 13}); 14 15wechatPay.http.get('/v3/certificates').then(res => { 16 wechatPay.logger.log(res.data); 17}).catch(err => { 18 wechatPay.logger.error(err); 19});
Test
1yarn test
TODO
- support upload
- test
Yueming Fang
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 0/19 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
- Warn: no pull requests merged into dev branch
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
3
/10
Last Scanned on 2025-01-13
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