https://github.com/nswbmw/airwallex-node
Airwallex Nodejs SDK
https://github.com/nswbmw/airwallex-node
Last synced: about 2 months ago
JSON representation
Airwallex Nodejs SDK
- Host: GitHub
- URL: https://github.com/nswbmw/airwallex-node
- Owner: nswbmw
- Created: 2023-08-19T05:00:21.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-08-14T13:46:57.000Z (about 1 year ago)
- Last Synced: 2025-08-09T01:14:55.594Z (2 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## airwallex
Airwallex Nodejs SDK
### Install
```sh
$ npm i airwallex --save
```### Usage
```js
const Airwallex = require('airwallex')
const airwallexClient = new Airwallex({
clientId: 'xxx', // CLIENT ID
clientSecret: 'xxx', // API KEY
environment: 'sandbox' // sandbox|production
});(async () => {
const balanceRes = await airwallexClient.execute({
method: 'get',
url: '/api/v1/balances/current'
})
/*
[
{
available_amount: 100,
currency: 'USD',
pending_amount: 0,
reserved_amount: 0,
total_amount: 100
},
...
]
*/
console.log(balanceRes)const createPaymentIntentRes = await airwallexClient.execute({
method: 'post',
url: '/api/v1/pa/payment_intents/create',
body: {
amount: 0.99,
currency: 'USD',
merchant_order_id: '1',
request_id: '64d280f6-4852-44d2-9572-5f19ed2c0a11'
}
})
/*
{
id: 'int_hkpdpqj9rgnwvaqu8a2',
request_id: '64d280f6-4852-44d2-9572-5f19ed2c0a11',
amount: 0.99,
currency: 'USD',
merchant_order_id: '1',
status: 'REQUIRES_PAYMENT_METHOD',
captured_amount: 0,
created_at: '2023-08-19T04:50:17+0000',
updated_at: '2023-08-19T04:50:17+0000',
available_payment_method_types: [ 'card', 'googlepay', 'applepay' ],
client_secret: 'eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2OTI0MjA2MTcsImV4cCI6MTY5MjQyNDIxNywidHlwZSI6ImNsaWVudC1zZWNyZXQiLCJwYWRjIjoiSEsiLCJhY2NvdW50X2lkIjoiN2YzMWY2NjctNzNlNi00NWRkLTg0NzMtODY1MzhmNWNjYzViIiwiaW50ZW50X2lkIjoiaW50X2hrcGRwcWo5cmdud3ZhcXU4YTIiLJJidXNpbmVzc19uYW1ljjoiQmlnZ20gQ28uLCBMaW1pdGVkIn0.oZgtLFrT4Lm1vb9UR0TmLhaMW__6C17kErfFcoOC-rU',
base_amount: 0.99
}
*/
console.log(createPaymentIntentRes)
})().catch(console.error)
```