boundless-checkout-react
eCommerce
TypeScript
Boundless Checkout React Component
Checkout React Component for Boundless Commerce.
About Boundless Commerce
API’s First Headless E-commerce CMS: We Provide An Admin-Side For Store Management, Powerful API, And Ready-To-Use
Checkout Area.
Installation
Besides the checkout component the API client should be installed:
yarn add boundless-api-client boundless-checkout-react
Or via NPM:
npm install boundless-api-client boundless-checkout-react --save
Getting Started
- Create client:
import {BoundlessClient} from 'boundless-api-client'; const apiClient = new BoundlessClient('<YOUR PERMANENT TOKEN>'); apiClient.setInstanceId('<YOUR INSTANCE ID>');
- Add component to the checkout page:
import {startCheckout, StarterWrapper} from 'boundless-checkout-react'; const starter = startCheckout(document.querySelector('.some-el'), { api: apiClient, onHide: () => console.log('on hide'), onThankYouPage: (data) => console.log('on thank you page', data), basename: '/shop/checkout', cartId: 'uid', logoSrc: 'https://domain/logo.png', logoText: 'My Logo' });
Props api
, onHide
, onThankYouPage
– are required, others are optional.
basename
– Start url for the checkout. If checkout located at /checkout
, then basename: '/checkout'
.
- Need more example? Look at: Checkout page at Next.js
Development process
-
Copy & adjust
.env.example
=>.env
-
yarn dev
– starts dev server at http://localhost:8080 - Real component usage can be tested locally via yarn link or manually creation symbolic link in node_modules.