Getting Started

This guide will get you all set up and ready to use the BetterCommerce API for Next.js StoreFront. We'll cover how to get started using one of our API clients and how to make your first API request. We'll also look at where to go next to find all the information you need to take full advantage of our powerful REST API.

Get your API keys

  1. Signup with the platform by getting in touch at signup@bettercommerce.io
  2. You can login and go to Settings > API Keys and copy API Key & Shared Secret.
  3. You will also need your OrgId & DomainId – which is provided by the BetterCommerce account manager.

Clone StoreFront Repository

  1. Clone the git repo from BetterCommerce StoreFront
  2. Update environment variables in .env file - details below.
  3. Run the solution locally or publish on vercel or any other static site supported hosting providers

Environment Variables

You shall be needing the following data to setup your Next.js storefront. The variables prefixed with NEXT_ are exposed to the front end. You need to have NEXT_PUBLIC for it to be accessed on the client side, else these variables are accessible only on the server.

KeyDescriptionDefault Value
COMMERCE_PROVIDERIdentify commerce provider being used in the storefrontBettercommerce
BETTERCOMMERCE_BASE_URLBase URL for the BC APIhttps://api20.bettercommerce.io
BETTERCOMMERCE_AUTH_URLAuth URL to get API tokenhttps://auth.bettercommerce.io/oAuth/Token
BETTERCOMMERCE_CLIENT_IDAPI KeyAvailable in the Settings > API Token
BETTERCOMMERCE_SHARED_SECRETAPI Shared SecretAvailable in the Settings > API Token
NEXT_PUBLIC_ORG_IDUnique OrgId for your organizationProvided by your BC Account Manager
NEXT_PUBLIC_DOMAIN_IDUnique Domain Id per domain within the organizationProvided by your BC Account Manager
NEXT_PUBLIC_API_VERSIONVersion of the API being usedv2
NEXT_PUBLIC_ENABLE_INFINITE_SCROLLShould the infinite scroll be enabled on PLPs or standard pagingTRUE
NEXT_PUBLIC_OMNILYTICS_ID If Omnilytics is enabled for realtime event capture, then this value to be providedYour account manager shall provide the link
NEXT_PUBLIC_GEO_ENDPOINTIf Omnilytics is enabled for realtime event capture, then this value is neededYour account manager shall provide the link
OMS_BASE_URLOMS API Url which is used for fetching basket delivery plan, split shipment, inventory, etc.https://omsapi20.bettercommerce.io/
LOQATE_KEYUsed for post code finder, can be left blank as well if loqate is not usedTo be fetched by signup with Loqate