Before we begin writing any code, let's first create an instance of Commerce.js we can share around our application to fetch products, categories, and merchant information.
Inside your terminal, install
npm install -E @chec/commerce.js
src, create a new directory
lib, and add the file
commerce.js. We'll follow the Commerce.js docs on instantiating the SDK, and export it as
// src/lib/commerce.js import CommerceSDK from "@chec/commerce.js"; const client = new CommerceSDK( "..." // Insert your Commerce.js Public API Key ); export default client;
If you don't want to create an account with Commerce.js to follow along with this tutorial, you can use the demo store public key pk_184625ed86f36703d7d233bcf6d519a4f9398f20048ec.