The Commerce Layer checkout application (React) provides you with a PCI-compliant, PSD2-compliant, and production-ready checkout flow powered by Commerce Layer APIs. You can fork this repository and deploy it to any hosting service or use it as a reference application to build your own.
Commerce Layer is a multi-market commerce API and order management system that lets you add global shopping capabilities to any website, mobile app, chatbot, wearable, voice, or IoT device, with ease. Compose your stack with the best-of-breed tools you already mastered and love. Make any experience shoppable, anywhere, through a blazing-fast, enterprise-grade, and secure API.
- Deploy the forked repository to your preferred hosting service or host it yourself. You can deploy with one click below:
-
Create your organization and get your credentials by following this credentials guide.
-
Build your sales channel with your favorite technologies and frameworks by leveraging our developer resources and documentation.
-
Get an access token for your application. You should generate this in your sales channel or use our Javascript authentication library.
-
Create an order associated with some line items.
-
Checkout the previously created order using the URL format:
<your-deployed-checkout-url>/:order_id?accessToken=<your-access-token>
. For example:https://checkout.yourbrand.com/PrnYhoVeza?accessToken=eyJhbGciOiJIUzUxMiJ9
.
There is a hosted version of the checkout application that is automatically enabled in your Commerce Layer account. You can customize it by adding your organization logo, favicon, primary color, Google Tag Manager ID, support telephone, and email address.
You can use the hosted checkout with the following URL format: https://<your-organization-subdomain>.checkout.commercelayer.app/:order_id?accessToken=<your-access-token>
.
For example: https://yourbrand.checkout.commercelayer.app/PrnYhoVeza?accessToken=eyJhbGciOiJIUzUxMiJ9
If you are using Commerce Layer CLI, you can leverage the checkout plugin to generate the URL from an SKU code (using the -S
flag), a bundle code (using the -B
flag), or from an order ID (using the -O
flag):
commercelayer checkout -S <skuCode>:<quantity> --open
commercelayer checkout -B <bundleCode>:<quantity> --open
commercelayer checkout -O <orderID> --open
-
Fork this repository (you can learn how to do this here).
-
Clone the forked repository like so:
git clone https://github.com/<your username>/commercelayer-react-checkout.git && cd commercelayer-react-checkout
- First, install dependencies and run the development server:
yarn install
yarn dev
-
Set your environment with
.env.local
starting from.env.local.sample
. -
Open http://localhost:3000 with your browser to see the result. You can use the following format to open the checkout:
http://localhost:3000/:orderId?accessToken=<your-access-token>
. -
Make your changes and create a pull request (learn how to do this).
-
Someone will attend to your pull request and provide some feedback.
-
Create an issue in this repository.
-
Ping us on Twitter.
This repository is published under the MIT license.