New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@leaf-x/we-chat-pay

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@leaf-x/we-chat-pay

WeChat payment V3.0.0 API.

  • 1.3.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

WeChatPay

WeChat pay V3 API.

Installation

npm install @leaf-x/we-chat-pay --save

Parameters

NameTypeDefault ValueDescription
appIdStringWeChat app ID.
publicAppIdStringWeChat public ID.
merchantIdStringRequiredMerchant ID.
merchantKeyStringRequiredMerchant key.
schemastringWECHATPAY2-SHA256-RSA2048Encryption algorithm mode.
privateKeyStringRequiredPrivate key.
publicCertificatePathStringPublic key certificate path.
publicCertificateDirStringPublic key certificate directory.
serialNoStringRequiredCertificate number.
urlStringhttps://api.mch.weixin.qq.comApi url address.
timeoutNumber3000Timeout time, in milliseconds.

Use

import {weChat} from '@leaf-x/we-chat-pay';

const pay = weChat({
  appId: 'wx3fb4x113xx8i',
  merchantId: '2362183',
  merchantKey: '123db752cf2c6955122d26d5',
  serialNo: '6D22333S311033394317A3332C444F31112371F',
  privateKey: fs.readFileSync(
    path.join(__dirname, '../public/certificate/private_key.pem'),
    'ascii'
  ),
  publicCertificateDir: path.join(__dirname, '../public/certificate/we_chat'),
});

const result = await pay.getAppPay({
  description: 'test',
  outTradeNo: '2133455555111233567',
  timeExpire: new Date(),
  notifyUrl: 'https://dev.api.leaf-x.com/v3/notifies',
  amount: {total: 1, currency: 'CNY'},
  sceneInfo: {payerClientIp: '127.0.0.0'},
});

console.info(result);

FAQs

Package last updated on 01 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc