npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

wxpay-nodejs-sdk

v0.2.6

Published

微信支付 API V3 Node.js SDK

Readme

wxpay-nodejs-sdk

Coverage TypeScript Node.js

微信支付 API V3 Node.js SDK,基于 TypeScript,提供类型安全的支付接口封装。

免责声明:本项目为社区开源项目,非微信支付官方 SDK。使用前请阅读 微信支付官方文档

安装

npm install wxpay-nodejs-sdk

要求 Node.js >= 18.0.0。

快速开始

import { WxPayClient, JsapiService, buildJsapiBridgeConfig } from 'wxpay-nodejs-sdk';
import fs from 'node:fs';

const client = new WxPayClient({
  mchid: '1900000100',
  apiV3Key: 'your-api-v3-key',
  serialNo: 'your-certificate-serial-number',
  privateKey: fs.readFileSync('/path/to/apiclient_key.pem'),
});

const jsapi = new JsapiService(client);

// 下单
const { data } = await jsapi.createOrder({
  appid: 'wx1234567890abcdef',
  mchid: '1900000100',
  description: '商品描述',
  out_trade_no: '订单号',
  amount: { total: 100 },
  payer: { openid: '用户openid' },
  notify_url: 'https://example.com/callback',
});

// 生成前端调起支付参数
const config = buildJsapiBridgeConfig('wx1234567890abcdef', data.prepay_id, privateKey);

回调通知

import { CallbackHandler } from 'wxpay-nodejs-sdk';

const handler = new CallbackHandler(apiV3Key, wxpay.certificates);
const callback = handler.processTransactionCallback(headers, rawBody);
console.log(callback.data.out_trade_no, callback.data.trade_state);

支持的 API

| Service | 说明 | | ------------------------------------------------------------------------------------------------------------------ | ----------------------- | | JsapiService | JSAPI 支付 / 小程序支付 | | AppService | APP 支付 | | H5Service | H5 支付 | | NativeService | Native 支付 | | CombineService / CombineH5Service / CombineAppService / CombineNativeService / CombineMiniProgramService | 合单支付 | | ProfitSharingService | 分账 | | PayScoreService | 微信支付分 | | ParkingService | 停车服务 | | BillService | 账单下载 | | MerchantTransferService | 商家转账 | | CouponService | 代金券 | | ComplaintService | 消费者投诉 | | PartnershipService | 委托营销 | | SmartGuideService | 智慧导购 | | BusinessCircleService | 商圈服务 | | PayGiftActivityService | 支付有礼 | | MedInsService | 医保服务 | | MediaService | 文件上传 | | SecurityService | 安全服务 | | CallbackHandler | 回调通知验签与解密 |

各 Service 的方法和参数请参考 微信支付官方文档,本 SDK 的方法名与官方 API 路径一一对应。

文档

免责声明

  1. 本项目为社区开源项目,由开发者个人维护,非微信支付官方 SDK
  2. 本项目仅提供对微信支付 API 的封装,不保证接口的完整性、准确性和时效性。
  3. 使用本 SDK 前,请务必阅读并遵守微信支付官方文档中的规则和要求。
  4. 因使用本 SDK 产生的任何损失,本项目及作者不承担任何责任。
  5. 在生产环境使用前,请务必进行充分的测试验证。

许可证

MIT