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

wechatpay-service-node-v3

v1.0.5

Published

微信支付服务商接口

Downloads

4

Readme

服务商版根据wechatpay-node-v3进行改编

欢迎大家加入一起完善这个api

前言

微信官方在2020-12-25正式开放了v3版本的接口,相比较旧版本v2有了不少改变,例如:

  • 遵循统一的Restful的设计风格
  • 使用JSON作为数据交互的格式,不再使用XML
  • 使用基于非对称密钥的SHA256-RSA的数字签名算法,不再使用MD5或HMAC-SHA256
  • 不再要求HTTPS客户端证书
  • 使用AES-256-GCM,对回调中的关键信息进行加密保护

使用

npm i wechatpay-service-node-v3

const wxPay = require('wechatpay-service-node-v3');
const fs = require('fs')

const pay = new wxPay({
  sp_appid: '服务商appid',
  sp_mchid: '服务商商户号',
  sub_appid: '子商户appid',
  sub_mchid: '子商户商户号',
  publicKey: fs.readFileSync('./apiclient_cert.pem'), // 公钥
  privateKey: fs.readFileSync('./apiclient_key.pem'), // 秘钥
  serial_no: '证书序列号',
  key: 'APIV3秘钥'
});

# 这里以微信小程序支付为例
try {
    # 参数介绍请看https://pay.weixin.qq.com/docs/partner/apis/partner-mini-program-payment/partner-mini-prepay.html
    const params = {
      description: '测试',
      out_trade_no: '6656554151',
      notify_url: 'https://pay.weixin.qq.com/',
      amount: { total: 1, },
      payer: { sub_openid: '用户子标识' ,sp_openid: '用户服务标识' ,},//sp_openid 和 sub_openid 两个字段必须要填一个
    };
    pay.transactions_jsapi(params)
  }