A server to power the iOS and Android SDK example projects.
The region is specified with the AFTERPAY_REGION
environment variable in the format of an IETF language four-letter hyphen separated language code and country code. (ie en-NZ
)
Supported regions are: en-AU
, en-CA
, en-CA
, es-ES
, fr-FR
, it-IT
, en-NZ
and en-US
.
NOTE: The example server will fallback to the
en-US
region if the environment variable is not set.
A Merchant ID and Secret Key are required for access to the Afterpay sandbox API in the selected region. These must be defined in the AFTERPAY_MERCHANT_ID
and AFTERPAY_SECRET_KEY
environment variables, respectively.
This can be done a number of ways:
- Exporting before starting the server
export AFTERPAY_MERCHANT_ID="#####" && \
export AFTERPAY_SECRET_KEY="************"
- Copy the
.env.example
to.env
and modify the values
Note: If an environment variable is set with both methods, the .env
file will take precedence.
Install dependencies:
npm install
Build the server:
npm run build
Run the server:
npm run start
View the server response at http://localhost:3000.
Our workflows run a linting step, but you should also run it locally while developing:
npm run lint
Contributions are welcome! Please read our contributing guidelines.
This project is licensed under the terms of the Apache 2.0 license. See the LICENSE file for more information.