Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hyunseob/alipay.js
Minimal SDK for Alipay (Not official)
https://github.com/hyunseob/alipay.js
alipay javascript nodejs payment
Last synced: 11 days ago
JSON representation
Minimal SDK for Alipay (Not official)
- Host: GitHub
- URL: https://github.com/hyunseob/alipay.js
- Owner: HyunSeob
- License: mit
- Created: 2017-01-25T05:27:54.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-02T13:54:56.000Z (almost 8 years ago)
- Last Synced: 2024-09-18T05:49:08.551Z (about 2 months ago)
- Topics: alipay, javascript, nodejs, payment
- Language: JavaScript
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# alipay.js
Minimal SDK for Alipay (Not official)## Installation
```
$ npm install --save-dev alipay.js
```## Usage
### Initialize
``` javascript
const Alipay = require('alipay.js');// Following config parameters are for Sandbox.
const alipay = new Alipay({
service: 'create_forex_trade',
partner: '2088101122136241',
key: '760bdzec6y9goq7ctyx96ezkz78287de',
gateway: 'https://openapi.alipaydev.com/gateway.do?_input_charset=utf-8',
sign_type: 'MD5'
});
```### Redirect to Alipay
``` javascript
const redirectForm = alipay.buildRedirect('get', {
out_trade_no,
total_fee,
subject,
currency: 'USD',
return_url
});res.send(redirectForm); // Usage in Express.js
```### Verify response from Alipay
``` javascript
// Redirected from Alipay
const isValidResponse = this.alipay.verifyResponse(req.query['sign'], req.query); // Usage in Express.js
```