@chuxingpay/yisheng
v2.0.7
Published
易生支付,Node.js版本的SDK
Downloads
2
Keywords
Readme
YiSheng Payment SDK
易生支付 SDK
YiSheng Office Docs
Notes
将易生提供的key,按照 rsa private key 格式排好,eg:
-----BEGIN RSA PRIVATE KEY----- MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAIqUuxd92eEBXVne DWhfNP6XCkLcGBO1YAulexKX+OdlfZzB/4NNHkOAQQy84k3ZgIUPIk5hewLbA+XG rk9Wih5HG3ZQeFugeoTcx3vwo7AQv7KnmcKEWFNlOr/EhB3JndmcQnBRsIRRdCP+ 7nobfBqU0jS8dnpcQX1AtBRZRnkfAgMBAAECgYAe+u70ansZ1Q9EduKycY5MWAHA PqnXRhXppJ3l4zmOqV6ye6Aef1ADsRlZuqQw2S3lESQPN7WjRskRRiBTtjn8Atul 9YeC7+QirP1K8seUP5gKB4bcjlzzl1m5dmxldkptJAmdzwYn8PRTW0+tFVyEaD/B 8hKGxij4Gew0e8bwCQJBAOboG3ttBESsG2cAtmP1MfKRTjVdY7qRMXzBybcAeobB bmgCQgybVXXgjbGai+qwrQqcVRIp6p1yDWTZxVSuDWsCQQCZpBhcayOCMZR6F8dQ JSuSSSIJw/GGN7IXfMYIqLxA2oGzlQ0B1DffOUe2wrid+WdpLuYCz2LYPQHDEgYM 1dwdAkEAnfwhEYm9ad73wLnUEQAqdHTGtex316aP3XQZt4Q0UQ73o2IoHsgI6OYD DIlZQfIv8xqTeiIDzEXEtEPrp8yOkQJBAIWAzFZKFqHD2UO6M8vVcKX9fGFF7TH2 ZX75Qc82Z9ZmyDs2sgW71QzX5hPN4cQLeqswQFeCw14orMZHfBBdKJUCQQDiWYk8 5okRugsWtxeJFhMEt2oUT+Kd8Yz5Aiz3J9XIS+zWtJrFlv+hXkVedPJ3xtBF32DZ rCbxDn3UjXipRaCP -----END RSA PRIVATE KEY-----
然后执行
openssl rsa -in private.pem -out private.pem
进行转换为 Nodejs crypto 识别的格式将 private.pem 作为 config.priKey
Install
$ npm i @chuxingpay/yisheng
Configuration
{
"priKey": "String, private key base64 format",
"partner": "Number, yisheng partner code",
"urls": {
"pay": "URL, yisheng payment url",
"query": "URL, yisheng query order url"
}
}
Example
const config = {
priKey: 'LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlDWGdJQkFBS0JnUUNLbExzWGZkbmhBVjFaM2cxb1h6VCtsd3BDM0JnVHRXQUxwWHNTbC9qblpYMmN3ZitEClRSNURnRUVNdk9KTjJZQ0ZEeUpPWVhzQzJ3UGx4cTVQVm9vZVJ4dDJVSGhib0hxRTNNZDc4S093RUwreXA1bkMKaEZoVFpUcS94SVFkeVozWm5FSndVYkNFVVhRai91NTZHM3dhbE5JMHZIWjZYRUY5UUxRVVdVWjVId0lEQVFBQgpBb0dBSHZydTlHcDdHZFVQUkhiaXNuR09URmdCd0Q2cDEwWVY2YVNkNWVNNWpxbGVzbnVnSG45UUE3RVpXYnFrCk1Oa3Q1UkVrRHplMW8wYkpFVVlnVTdZNS9BTGJwZldIZ3Uva0lxejlTdkxIbEQrWUNnZUczSTVjODVkWnVYWnMKWlhaS2JTUUpuYzhHSi9EMFUxdFByUlZjaEdnL3dmSVNoc1lvK0Juc05Idkc4QWtDUVFEbTZCdDdiUVJFckJ0bgpBTFpqOVRIeWtVNDFYV082a1RGOHdjbTNBSHFHd1c1b0FrSU1tMVYxNEkyeG1vdnFzSzBLbkZVU0tlcWRjZzFrCjJjVlVyZzFyQWtFQW1hUVlYR3NqZ2pHVWVoZkhVQ1Vya2traUNjUHhoamV5RjN6R0NLaThRTnFCczVVTkFkUTMKM3psSHRzSzRuZmxuYVM3bUFzOWkyRDBCd3hJR0ROWGNIUUpCQUozOElSR0p2V25lOThDNTFCRUFLblIweHJYcwpkOWVtajkxMEdiZUVORkVPOTZOaUtCN0lDT2ptQXd5SldVSHlML01hazNvaUE4eEZ4TFJENjZmTWpwRUNRUUNGCmdNeFdTaGFodzlsRHVqUEwxWENsL1h4aFJlMHg5bVYrK1VIUE5tZldac2c3TnJJRnU5VU0xK1lUemVIRUMzcXIKTUVCWGdzTmVLS3pHUjN3UVhTaVZBa0VBNGxtSlBPYUpFYm9MRnJjWGlSWVRCTGRxRkUvaW5mR00rUUlzOXlmVgp5RXZzMXJTYXhaYi9vVjVGWG5UeWQ4YlFSZDlnMmF3bThRNTkxSTE0cVVXZ2p3PT0KLS0tLS1FTkQgUlNBIFBSSVZBVEUgS0VZLS0tLS0K',
partner: 900029000000354,
urls: {
// pay: 'https://test_nucc.bhecard.com:9088/api_gateway.do',
// query: 'https://test_nucc.bhecard.com:9088/api_gateway.do'
pay: 'http://yisheng.proxy.chuxingpay.com',
query: 'http://yisheng.proxy.chuxingpay.com'
},
merchantId: '900029000000354',
accType: '2'
}
const yisheng = new YiShengSDK(config)
const params = {
"amount": "100",
"out_trade_no": `${Date.now()}`,
"acc": "4392260802157617",
"name": "张四"
}
const result = await yisheng.pay(params)