1.3.3 • Published 3 years ago
@leaf-x/we-chat-pay v1.3.3
WeChatPay
WeChat pay V3 API.
Installation
npm install @leaf-x/we-chat-pay --save
Parameters
Name | Type | Default Value | Description |
---|---|---|---|
appId | String | WeChat app ID. | |
publicAppId | String | WeChat public ID. | |
merchantId | String | Required | Merchant ID. |
merchantKey | String | Required | Merchant key. |
schema | string | WECHATPAY2-SHA256-RSA2048 | Encryption algorithm mode. |
privateKey | String | Required | Private key. |
publicCertificatePath | String | Public key certificate path. | |
publicCertificateDir | String | Public key certificate directory. | |
serialNo | String | Required | Certificate number. |
url | String | https://api.mch.weixin.qq.com | Api url address. |
timeout | Number | 3000 | Timeout 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