This directory contains a simple example of a Node server integrated with the Airwallex Payment API. The server demonstrates how to create and retrieve payment intents.
- node.js
npm
oryarn
package manager
- Clone the root airwallex-payment-demo project to your local machine
git clone https://github.com/airwallex/airwallex-payment-demo
-
Navigate into the react directory with
cd node
-
Install the package with
yarn install
ornpm install
-
Copy the contents of
.env_copy
into a.env
file by runningcp .env_copy .env
-
Run the project in development mode with
npm start
oryarn start
. See the project at localhost:3002
You must change your application keys in the .env file to create/retrieve payment intents.
Your CLIENT_ID
and API_KEY
can be found on the Airwallex Webapp Platform under Account Settings > Developer. Do not share these keys because they allow access to your payments.
For demo purposes, both routes below can be accessed with a GET request. Be sure to change the create route to a POST request in production to protect your keys and payment details.
- Create a payment intent at http://localhost:3002/api/v1/intent/create
- Retrieve a payment intent at http://localhost:3002/api/v1/intent/:id
- remember to change id to a live intentId in the url
Find more details about the Airwallex API here!
Shirly Chen