Prerequisites

Before being able to start using Shopper API, make sure you have followed the get-started guide for prerequisites in configuration and management API requirements.


Session

Overview

When you initiate a session, it will generate a cart and a token (JWT) for subsequent calls. Sessions are not only the gateway to initiating a checkout but also encapsulate all the necessary transactional and cart details.

Starting a Session and Response Structure

When you start a session by making a POST call to /sessions/start, the API returns a JSON response containing the following:

  • Transactional Information: Price, total amount, taxes, etc.
  • Cart Content Details: Items in the cart, their attributes, and quantities.

Session

FieldTypeDescription
idstringThe unique identifier for the session.
storeGroupIdstringThe group ID of the store.
countryCodestringCountry code of the session.
languageCodestringLanguage code of the session.
currencyCodestringCurrency code applicable to this session.
cartobjectDetails about the cart in the session (described in the next table).
jwtstringThe JSON Web Token to be used for authenticating subsequent calls.
createdAtstringTimestamp marking the creation of the session.
expiresAtstringTimestamp marking the expiration date of the session.
totalAmountintegerThe total amount for the session including tax, in cents.
totalTaxAmountintegerThe total tax amount for the session, in cents.
paymentStatusstringThe payment status of the session (PENDING, PAID, etc.).
Cart Object
FieldTypeDescription
idstringUnique identifier for the cart.
itemsarrayArray of cart items, each containing attributes like SKU, price, etc.
discountCodestringThe discount code applied to the cart, if any.
discountAmountintegerThe total amount of discount applied to the cart, in cents.
subTotalAmountintegerThe subtotal amount before any discounts are applied, in cents.
totalAmountintegerThe final total amount including all discounts, in cents.
totalTaxAmountintegerThe total tax amount for the cart, in cents.

For a more detailed understanding of each attribute, you can refer to API Reference (Shopper).

Operations

  • Add Item: POST /sessions/items
  • Update Item: PUT /sessions/items
  • Add Discount Code: POST /sessions/discount-code

The response will include all transactional information as well as cart content related details. See schema in API Refernce for detailed description.

Session Expiry

A session will end either with a successful checkout or after 30 days.