1.3.3 • Published 3 years ago

@leaf-x/we-chat-pay v1.3.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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);
1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.3

4 years ago

1.2.0

4 years ago

1.0.2

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.2.2

4 years ago

1.0.4

4 years ago

1.2.1

4 years ago

1.0.3

4 years ago

0.3.5

4 years ago

0.5.0

4 years ago

0.4.1

4 years ago

0.3.2

4 years ago

0.4.0

4 years ago

0.3.1

4 years ago

0.3.4

4 years ago

0.4.2

4 years ago

0.3.3

4 years ago

0.3.0

4 years ago

0.2.1

4 years ago

0.2.2

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago