This mini application demonstrates the use of Maya Checkout API in order to accept card and e-wallet payments.
If you want to see the relevant integration code directly, see the file checkout.ts
This project was created with React (React Redux and Thunk) and TypeScript.
Do not build your application on top of this demo.
- Checkout API keys (public and secret)- needed as authorization in API calls
- Run
npm install
to install all needed packages. - Run
npm start
to start the application. (see next part for note on environment variables)
Example:
npm start
You can set these variables in your environment, or in a .env
file in the root directory.
env variable | description | default |
---|---|---|
REACT_APP_CHECKOUT_PUBLIC_API_KEY | (required) public api key | |
REACT_APP_CHECKOUT_SECRET_API_KEY | secret api key (not needed for this demo) | |
REACT_APP_HOST_URL | host url of the app, used for redirect urls | http://localhost:3000 |
REACT_APP_PATH_PREFIX | path prefix, used for redirect urls | / |
PORT | port that the app listens to | 3000 |
Example
REACT_APP_CHECKOUT_PUBLIC_API_KEY=pk-gjldkfjgkldfjgljdfglawas
REACT_APP_CHECKOUT_SECRET_API_KEY=sk-sjsdfhdsjfhsjkldfsdfhsdf
Take note to not make your secret api key visible in your web/fronend environment. It is available in this demo for demonstration purposes only, and you are expected to perform API calls using the secret api key from your application's backend.
- Adding products to cart
- Checking out products using Maya Checkout
Routing / handling of React views / pages
CSS for the application
Redux actions
Customized React components used within the application
Redux reducers
Redux thunks for handling asynchronous logic
Customized React views / pages
Service files - API calls
Type assertions
Helper functions