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 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-wechat-pay-sdk

v0.1.2

Published

[Node WeChat Pay SDK 文档](http://node-wechat-pay-sdk.unifylabs.top/)

Downloads

14

Readme

Node WeChat Pay SDK

Node WeChat Pay SDK 文档

WechatPay Node SDK 适配微信支付 API v3,封装了大量调用微信支付需要实现的技术细节,让 Node 项目接入微信支付更便捷。

注意:

  1. 该库针对微信支付 Native 支付的场景
  2. 该库的使用是假设你已经读过微信支付官方文档,知道什么是 API v3、API v3 密钥、商户 API 证书、商户 API 私钥、微信支付平台证书、签名,并且了解 Native 支付场景有什么 api。
  3. SDK 基于 Node v20 的版本进行开发,依赖 Node.js crypto 模块,为了确保 SDK 的正常使用,请确保项目的 Node.js 版本大于等于 v20。

安装

npm install node-wechat-pay-sdk
# or
pnpm add node-wechat-pay-sdk

使用

初始化对象:

import { WeChatPay } from "node-wechat-pay-sdk";

const wechatPay = new WeChatPay({
  appid: "xxx",
  mchid: "xxx", // 商户号
  merchantPrivateKey: "xxx", // 商户私钥
  merchantSerialNo: "xxx", // 商户API证书序列号
  platformSerialNo: "xxx", // 平台证书序列号
  v3Key: "xxx", // API v3 密钥
});

调用 api 接口

const result = await wechatPay.payTransactionsNative({
  out_trade_no: "xxx",
  time_expire: "xxx",
  description: "xxx",
  notify_url: "xxx",
  amount: {
    total: 100, // 根据自己实际情况传递
  },
  // ...
});