Generate wechat / wework pay signture for NodeJs

Overview

WXSIGN

Generate wechat / wework pay signture

  • The library uses strdm 🔍 to generate random strings of a specified length

How to installtion?

  # yarn
  yarn add wsign -S --registry=https://registry.npmjs.org/

  # npm
  npm i wsign -S --registry=https://registry.npmjs.org/

How to use?

CommonJS

const WxSign = require('wsign');

const wxsign = new WxSign({
  key: 'ilq4i3rXe70rz3j4hrpjMKI3jqCDpr0q',
  agent: {
    key: '/srv/ssl/wxsign/apiclient_key.pem', // or Enter the contents of the apiclient_key.pem file
    cert: '/srv/ssl/wxsign/apiclient_cert.pem', // or Enter the contents of the apiclient_cert.pem file
  }
});

const mchid = '1111111';
const nonce_str = WxSign.generateString(32);
const partner_trade_no = wxsign.generateOrder(32);
const openid = 'ilq4i3rXe70rz3j4hrpjMKI3jqCDpr0q';

// 根据微信/企业微信支付文档填写参数
// Fill in the parameters according to the WeChat / WeWork payment document
wxsign.setParams({
  amount: 100,
  check_name: 'NO_CHECK',
  desc: '活动奖金',
  mch_appid,
  mchid,
  nonce_str,
  openid,
  partner_trade_no,
});

wxsign.setData('workwx_sign', wpay.generateSign());
wxsign.setData('agentid', 3010046);
wxsign.setData('remark', 'RedBag');
wxsign.setData('wishing', 'RedBag');

console.log(wxsign.generateSignXML('sign'))

// 也可以这样写
// can also be used like this
wxsign
  .setParams({
    act_name: 'RedBag',
    mch_billno,
    mch_id,
    nonce_str,
    re_openid,
    total_amount: 100,
    wxappid,
  })
  .setData('workwx_sign', wxsign.generateSign())
  .setData('agentid', 3010046)
  .setData('remark', 'RedBag')
  .setData('wishing', 'RedBag');

wxsign
  .setData('workwx_sign', wxsign.generateSign())
  .setData('agentid', 3010046)
  .setData('remark', 'RedBag')
  .setData('wishing', 'RedBag');

ESM

import WxSign from 'wsign';

const wxsign = new WxSign({
  key: 'ilq4i3rXe70rz3j4hrpjMKI3jqCDpr0q',
  agent: {
    key: '/srv/ssl/wxsign/apiclient_key.pem', // or Enter the contents of the apiclient_key.pem file
    cert: '/srv/ssl/wxsign/apiclient_cert.pem', // or Enter the contents of the apiclient_cert.pem file
  }
});

const mchid = '1111111';
const nonce_str = WxSign.generateString(32);
const partner_trade_no = wxsign.generateOrder(32);
const openid = 'ilq4i3rXe70rz3j4hrpjMKI3jqCDpr0q';

// 根据微信/企业微信支付文档填写参数
// Fill in the parameters according to the WeChat / WeWork payment document
wxsign.setParams({
  amount: 100,
  check_name: 'NO_CHECK',
  desc: '活动奖金',
  mch_appid,
  mchid,
  nonce_str,
  openid,
  partner_trade_no,
});

wxsign.setData('workwx_sign', wpay.generateSign());
wxsign.setData('agentid', 3010046);
wxsign.setData('remark', 'RedBag');
wxsign.setData('wishing', 'RedBag');

console.log(wxsign.generateSignXML('sign'));

// 也可以这样写
// can also be used like this
wxsign
  .setParams({
    act_name: 'RedBag',
    mch_billno,
    mch_id,
    nonce_str,
    re_openid,
    total_amount: 100,
    wxappid,
  })
  .setData('workwx_sign', wxsign.generateSign())
  .setData('agentid', 3010046)
  .setData('remark', 'RedBag')
  .setData('wishing', 'RedBag');

wxsign
  .setData('workwx_sign', wxsign.generateSign())
  .setData('agentid', 3010046)
  .setData('remark', 'RedBag')
  .setData('wishing', 'RedBag');
You might also like...

Stays: book accommodation on-chain, pay in crypto, and help local communities

Stays: on-chain bookings Installation Make sure you have node and nvm installed: nvm use v16 npm install -g yarn npm install -g lerna yarn install ler

Jun 2, 2022

Awesome Pay - This is a virtual payment module made from react

Awesome Pay - This is a virtual payment module made from react

Jun 18, 2022

Open-source Solana Pay framework

Open-source Solana Pay framework

Bedrock Bedrock is a framework for Solana Pay that: Standardizes the methodology used to create transaction requests Provides implementations for many

Nov 26, 2022

Generate deterministic fake values: The same input will always generate the same fake-output.

Generate deterministic fake values: The same input will always generate the same fake-output.

import { copycat } from '@snaplet/copycat' copycat.email('foo') // = '[email protected]' copycat.email('bar') // = 'Thurman.Schowalter668@

Dec 30, 2022

CLI Progress Bar implemented in NodeJS to track Time, ETA and Steps for any long running jobs in any loops in JS, NodeJS code

CLI Progress Bar implemented in NodeJS to track Time, ETA and Steps for any long running jobs in any loops in JS, NodeJS code

NodeJS-ProgressBar CLI Progress Bar for NodeJS and JavaScript to track Time, ETA and Steps for any long running jobs in any loops in JS, NodeJS code D

Nov 14, 2022

A CLI tool to create a NodeJS project with TypeScript CTSP is a CLI tool to make easier to start a new NodeJS project and configure Typescript on it.

A CLI tool to create a NodeJS project with TypeScript CTSP is a CLI tool to make easier to start a new NodeJS project and configure Typescript on it.

CTSP- Create TS Project A CLI tool to create a NodeJS project with TypeScript CTSP is a CLI tool to make easier to start a new NodeJS project and conf

Sep 13, 2022

🚀AI拟声: 5秒内克隆您的声音并生成任意语音内容 Clone a voice in 5 seconds to generate arbitrary speech in real-time

🚀AI拟声: 5秒内克隆您的声音并生成任意语音内容 Clone a voice in 5 seconds to generate arbitrary speech in real-time

English | 中文 Features 🌍 Chinese supported mandarin and tested with multiple datasets: aidatatang_200zh, magicdata, aishell3, and etc. 🤩 PyTorch work

Dec 29, 2022

Generate meshes from signed distance functions and constructive solid geometry operations.

Generate meshes from signed distance functions and constructive solid geometry operations.

sdf-csg Generate meshes from signed distance functions and constructive solid geometry operations. This library is heavily based upon Inigo Quilez's 3

Oct 24, 2022

A pure JavaScript Web Page to retrieve real-time OTP through a web page and generate/scan QR codes.

A pure JavaScript Web Page to retrieve real-time OTP through a web page and generate/scan QR codes.

2FA-Solver A pure JavaScript Web Page to retrieve real-time OTP through a web page and generate/scan QR codes. It can be used as an offline web page b

Dec 7, 2022
Owner
y.tianyuan
CODE IS MY LIFE 👨🏻‍💻
y.tianyuan
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
A UI library by WeChat official design team, includes the most useful widgets/modules in mobile web applications.

WeUI - tailor-made for WeChat web service 中文版本 Introduction WeUI is an WeChat-like UI framework officially designed by the WeChat Design Team, tailor-

Tencent 26.6k Jan 2, 2023
🔍 Full stack engineers archive applet for Wechat.

Full Stack Engineers Archive Contributing We welcome you to join the development of this applet. Please see contributing document. ?? Also, we welcome

Wechat applet Development Team 3 May 24, 2022
Crawl WeChat Moments and visualize friend interactions.

请注意:微信朋友圈内容可能涉及隐私,如果要使用本爬虫进行个人研究以外的其他活动,请仔细考虑可能带来的社会影响与法律后果。 使用方法: 配环境。 conda create -n friends conda activate friends conda install psutil conda inst

null 19 Nov 24, 2022
A UI library by WeChat official design team, includes the most useful widgets/modules.

WeUI for 小程序 为微信小程序量身设计 概述 WeUI 是一套同微信原生视觉体验一致的基础样式库,由微信官方设计团队为微信内网页和微信小程序量身设计,令用户的使用感知更加统一。包含button、cell、dialog、 progress、 toast、article、actionsheet、

Tencent 14.5k Jan 4, 2023
A jQuery Plugin for viewing pictures like Wechat moments

A jQuery Plugin for viewing pictures like Wechat moments

馒头饭 25 Nov 10, 2022
Pay Creators to Promote your Product in $CRYPTO

Next.js + Tailwind CSS Example This example shows how to use Tailwind CSS (v3.0) with Next.js. It follows the steps outlined in the official Tailwind

Satyam Kulkarni 1 Feb 7, 2022
NFT vending machine proof of concept built on Solana Pay, Metaplex, Phantom Mobile and Next.js.

Solana NFT Vending Machine This is a proof of concept of an NFT vending machine built using Solana Pay, Metaplex, Phantom Mobile, and Next.js. This wa

Matt Rosenzweig 55 Dec 15, 2022
This is a decentralised application that allows you to pay your employees salary in Ethereum.

This is our project for Ethernals Hackathon. Built on Polygon and deploye dusing Spheron. You can check out live project here: https://ethernals_dapp-

Kushagra Sarathe 3 Sep 20, 2022