storeInitial Tenant Checkout Configuration

Start configuring a fresh tenant to enable your online store quickly and efficiently.

This tutorial guides developers through configuration steps of a fresh Emporix tenant with the aim of enabling checkout functionality in the storefront. Start with a brand new tenant to set up and enable all the required features from scratch.

The steps take you through the following paths:

  • Tenant setup - Basic tenant and site settings

  • Data import - Catalog, products, and pricing setup

  • Customer setup - Test customer and address configuration

  • Storefront checkout flow - The scenario to make a purchase and complete checkout on the storefront as a customer

After completing the steps you will understand the minimum configuration needed for checkout and how to successfully complete a checkout in the Emporix B2B Commerce Frontend, or a custom storefront solution. The described steps help you achieve a working configuration for the whole checkout flow with simple examples, but you can further extend this configuration for your specific business needs. Consider configuring multiple delivery times (for scheduled deliveries), multiple shipping methods (for different delivery options), multiple payment methods (for customer choice), enhancing product with images and media, as well as brand and label setup.

Prerequisites

To get started, make sure you have:

  • Emporix Account - an active Emporix tenant created

  • API keys - credentials to make relevant API calls

circle-info

We recommend you to be prepared to collect these values as you go. Each step lists where to copy them from.

Placeholder
Description
Where it comes from

{{tenant}}

Tenant identifier

Your tenant id

{{client_id}}, {{client_secret}}

Service credentials

Emporix Developer Portal

{{storefront_client_id}}

Storefront client id

Emporix Developer Portal

{{category_id}}

Category id

Create a category response

{{product_id}}

Product id

Create a product response

{{priceModelId}}

Price model id

Create a price model response

{{priceId}}

Price id

Create a price response

{{zoneId}}

Shipping zone id

Create a shipping zone response

{{shipping_method_id}}

Shipping method id

Create a shipping method response

{{cartId}}

Cart id

Create a cart response

Authorization

For the configuration steps (tenant setup, data import, and customer setup), the Service Access Token is required.

1

Get authorization token

To obtain proper access, send the authorization request to the Requesting a service access tokenarrow-up-right endpoint.

circle-check
rectangle-terminalAPI Referencechevron-right

How to enable checkout functionality

Configure a fresh tenant

Follow these steps to provide basic configuration for your tenant, such as payment, site, language, currency, tax, and shipping zones and methods.

circle-check
1

Configure payment method

Create invoice for a minimal setup of payments. To create a new payment method, call the Creating a single payment mode entityarrow-up-right endpoint. For real payments, configure a provider-specific mode with its required credentials.

circle-check
rectangle-terminalAPI Referencechevron-right
2

Activate a country, currency and language

You need to activate countries where you want to operate, as well as add relevant currency and language.

circle-check
rectangle-terminalAPI Referencechevron-right
  • You need to activate currencies relevant for the countries where your business operates or relevant to your business model. Ensure currency codes are ISO 4217 compliant. Create a Polish Zloty currency with the Creating a new currencyarrow-up-right endpoint:

circle-check
rectangle-terminalAPI Referencechevron-right
  • Specify the languages that your business communicates with suppliers and customers. Emporix supports a broad choice of languages, including regional language variants. The tenant's language configuration is stored under the project_lang key, while site-specific language configuration is stored in the defaultLanguage and languages fields, inside the Site object. To set Polish and English as project languages, use the Updating a configurationarrow-up-right endpoint:

circle-check
rectangle-terminalAPI Referencechevron-right
3

Add relevant tax calculation configuration

Tax rates define the checkout calculations relevant to a given country. Create tax classes with rates applicable in Poland using the Creating a new tax configurationarrow-up-right endpoint. Ensure your rates reflect the desired gross/net calculation strategy for your storefront.

circle-check
rectangle-terminalAPI Referencechevron-right
4

Create a site

Determine a site by a country you operate in or by a brand you want to sell in your store. Create a PL site for the Polish market by sending a request to the Creating a sitearrow-up-right endpoint. Include the homeBase address country, which is required for shipping calculations. Keep site, country, currency, tax, and shipping zone aligned.

circle-check
rectangle-terminalAPI Referencechevron-right
5

Configure a shipping zone, method and delivery times

Define where you want to ship your goods and how.

circle-check
rectangle-terminalAPI Referencechevron-right
circle-check
rectangle-terminalAPI Referencechevron-right
  • Define the delivery times and connect them with the shipping information. Use the Creating a delivery timearrow-up-right endpoint. The validateOverlap flag enables checks to see whether delivery time ranges for slots of the same shipping method overlap each other. The deliveryWindowId and slotId used later in cart creation come from this response.

circle-check
rectangle-terminalAPI Referencechevron-right

Import data

Once your tenant and site are ready, it's time to import and organize the project data. Follow the steps to create a basic structure for your products that are to be visible in your store.

1

Create a category

Define a category or a category hierarchy to make it easier for customers to find the products. Create a Tools category by sending a request to the Creating a new categoryarrow-up-right endpoint. Copy the returned id for catalog assignment.

circle-check
rectangle-terminalAPI Referencechevron-right
2

Create a catalog

A catalog determines which categories and category trees are available on your site or sites. Create a Home catalog and publish it on the PL site. Use the Creating a catalogarrow-up-right request. Use the category id from the previous step.

circle-check
rectangle-terminalAPI Referencechevron-right
3

Create a product

Add a product to the database with the Creating a new productarrow-up-right endpoint. Copy the product id and yrn from the response for the price and cart steps.

circle-check
rectangle-terminalAPI Referencechevron-right
4

Configure a price

Prices are associated with a particular site, so you can set different price configurations for the same product for each site it is visible at. Setting a price allows you to define a tier structure (BASIC, QUANTITY, etc.).

circle-check
rectangle-terminalAPI Referencechevron-right
  • Create a price for the product on the PL site and connect it with the price model by sending a request to the Creating a new pricearrow-up-right endpoint. Save the returned price id.

circle-check
rectangle-terminalAPI Referencechevron-right
5

Assign a category

Add the product to a category tree for its better searchability. Call the Assigning a resource to a categoryarrow-up-right.

circle-check
rectangle-terminalAPI Referencechevron-right
6

Define availability

Availability determines stock level of a product for a given site. Define the availability by calling the Creating a new availability for a productarrow-up-right.

circle-check
rectangle-terminalAPI Referencechevron-right

Set up a customer

The tenant and products are ready, so it's time to add customers who can test out the checkout functionality.

1

Create a customer

Create a B2B customer with the Creating a customerarrow-up-right request, providing basic customer's details. Set active to true if you plan to log in with this account.

circle-check
rectangle-terminalAPI Referencechevron-right
2

Specify a customer's address

Add and assign an address to the customer's profile. You can define separate addresses for shipping and billing purposes, marking them with relevant tags. Use the Adding a customer addressarrow-up-right endpoint.

circle-check
rectangle-terminalAPI Referencechevron-right

Storefront checkout flow

The tenant setup is prepared to handle checkout functionality. Now, ensure that your storefront setup (or the Emporix B2B Commerce Frontend) is able to process the data and pass it to the relevant API endpoints.

circle-exclamation

The example checkout flow on the storefront side includes the following steps.

1

Start an anonymous session

An anonymous session begins when a user enters your storefront, before they choose to log in. Get an anonymous access token with the Requesting an anonymous tokenarrow-up-right endpoint. Pass the Storefront Client ID.

circle-check
rectangle-terminalAPI Referencechevron-right

This request creates a new session-context document. The anonymous token is valid for one hour. After that time, refresh it to keep the same session ID associated.

2

Enable customer login

To allow your customers to authorize themselves, enable the Logging in a customerarrow-up-right endpoint on the storefront. Authorize the request with the anonymous_token.

circle-check
rectangle-terminalAPI Referencechevron-right
circle-exclamation

This operation returns Customer access token and Customer SaaS token, which convey information about the customer and their activities on the storefront. Use these values for Authorization and saas-token headers in the next steps.

3

Create a cart

Creating a cart operation gathers the customer's session details, including for anonymous customers. Enable cart creation on the storefront using the Creating a new cartarrow-up-right endpoint. The request needs to be authorized with the Customer Access Token or Anonymous Access Token, depending on whether a customer is already logged in. Use the deliveryWindow values from the delivery times response.

circle-check
rectangle-terminalAPI Referencechevron-right
4

Add items to the cart

To allow customers to place some items in the cart, use the Adding a product to cartarrow-up-right endpoint. Use the product yrn and price id created earlier.

circle-check
rectangle-terminalAPI Referencechevron-right
5

Enable the price matching mechanism

Price matching allows your customers to find the best price calculated on the fly during their session, including discounts, offers, segments or similar information. To that end, use the Matching prices for session contextarrow-up-right endpoint in our storefront setup. The request is authorized with the CustomerAccessToken, so make sure you pass that data from the customer entering your store. Call this before checkout when you need to recalculate prices based on session context.

circle-check
rectangle-terminalAPI Referencechevron-right
6

Proceed to checkout

Once the customer wants to finalize the purchase, enable the checkout option. The checkout does several validation checks on the provided data, including cart details, product availability, customer details, payment method, price calculations, shipping information and delivery. The operation creates an order, handles the payment, and closes the cart. To enable checkout operation on your storefront, use the Triggering a checkoutarrow-up-right endpoint.

circle-check
rectangle-terminalAPI Referencechevron-right
7

Verify order creation

As a last step, verify if the order placed by a customer is created accordingly. To display the order details to the customer on the storefront, use the Retrieving order detailsarrow-up-right endpoint. Authorize the request with the customer access token.

To obtain the order details and later send tem to the ERP/CRM system, use the Retrieving sales order details. Authorize the request with the OAuth access token.

As a result, you retrieve all the details related to the placed order, which you can display in the UI.

chevron-rightExample responsehashtag

From there, you can process the order.

circle-check
rectangle-terminalAPI Referencechevron-right

Troubleshooting

Problem
Recommendation

Missing home base address

Set homeBase.country on the site to match the site country so shipping calculations succeed.

Currency mismatch between tenant and site

Ensure the site currency is active and matches the currency used in prices and carts.

Tax configuration missing for target country

Create a tax configuration for the target country and use matching tax class codes on products and shipping.

Shipping zone not matching customer address

Add the customer’s country/postal range to the shipping zone or set the correct default zone.

Products without prices

Create a price model and price for each product and site before checkout.

Sites not linked to catalogs

Publish the catalog to the site and include the relevant category ids.

Last updated

Was this helpful?