Checkout Service Tutorials
As the checkout functionality is the core of your commerce operations, make sure it works properly in your online store.
The checkout service validates data that comes from different points in the system: cart, order, payment, delivery zone, shipping method, tax, and customer. Therefore, you need proper configuration of these services to make checkout work as expected. This tutorial guides you through the basic setup of the checkout service.
How to configure the Checkout Service
Gather information about a customer's session on the storefront
You need details about the customer's access and session tokens as these details influence the checkout process.
- When a user enters your storefront, before they choose to log in, an anonymous user session is created.
- Log the customer in and send an authorization request to the
Requesting a customer token endpoint.
attention
You can skip this step and continue with the checkout process as a guest customer without the need to log in.
This operation returns the customer's access token and Saas token, which convey information about the customer and their activities on the storefront. You might need these details in subsequent steps to get a proper authorization when a customer is logged in.
Add tax configuration
Each country that you operate in may have different tax rules for different products and services. Add relevant configuration to calculate taxes accordingly.
Add tax configuration by sending a request to theDefine the delivery zone, method, and time
Delivery zone is the area where you ship your goods to. You can define a country, or a zip code that you operate within. Delivery method is dependant on a specific site and delivery zone.
- Define the delivery zone by sending a request to the
Creating a shipping zone endpoint.
- Specify how the goods can be shipped to a customer by sending a request to the
Creating a shipping method endpoint.
- Define delivery time that will be matched with the delivery method and zone by sending the request to the
Creating a delivery time endpoint.
Add products to your store
To create and add multiple products to your store, send the request to theCreate a price model and connect it to products
Price model defines your pricing strategy. You can specify how you want to go about price tiers and selling volumes.
- To define a price model send a request to the
Creating a new price model endpoint.
- Create a price for a specific product by sending a request to the
Creating a new price endpoint.
- Match the price by session context to allow your customers find the best price based on information retrieved from the session context.
warning
The following request requires using the customer's access token for authorization, either anonymous or logged in, as the response contains the bearer's information.
Create a cart
warning
The following requests require using the customer's access token for authorization, either anonymous or logged in, as the response contains the bearer's information.
- You have to enable an option to create a cart on your site while a customer is browsing through your products. Creating a cart takes care of things like gathering customer's session details, even anonymous, or setting up a proper cart's currency for final calculations at checkout. There are two options to create carts using API:
- Create a cart by sending a request to the
Creating a new cart endpoint.
- Create a cart by sending a
GET
request withcreate=true
parameter to theRetrieving a cart's details by criteria endpoint.
- Add items to the cart by sending the request to the
Creating a new cart endpoint.
Define payment methods
You can configure payment methods in the Payment Gateway Service. Check the available options in the Payment Systems documentation.
Trigger the checkout
attention
To complete the checkout, there are two options:
- The customer has to be logged in to the storefront and then the following request requires using the customer's access token for authorization - see Gather information about a customer's session on the storefront .
- The customer continues as a guest without logging in - the
customer:guest
field has to be set totrue
.
Once a customer places the product in a cart, they can proceed with the checkout process.
The checkout service validates the data that come from customer's session token, the cart, and tiered prices, and then proceeds with the delivery and payment details. Then, it handles the payment and creates an order in the system, closing the cart.
You can trigger a checkout process through API as well by sending a request to the