CheckoutSession
is the core interface representing a checkout session in the Ollie Shop ecosystem. It contains all the necessary data to render and process a typical checkout flow, including cart items, customer information, shipping details, payment methods, and totals.
Structure Overview
Properties
id
Type: string
Description: A unique identifier for the checkout session. This is a platform-specific ID.
cartItems
Type: CartItem[]
Description: An array of items in the user’s cart. Each item contains pricing information, availability, and other product information. Each cart item includes:
id
: Unique identifier for the cart item (e.g., SKU code)sellerId
: (Optional) Identifier for the marketplace seller providing the itemname
: Display name of the itemprice
: Current (sale) price in minor units (e.g., cents)originalPrice
: Original (non-sale) price in minor unitsquantity
: Number of this item in the cartavailable
: Whether the item is in stockindex
: Position index in the cartimage
: URL for the item’s imageurl
: (Optional) URL to the product detailsvariantDetails
: (Optional) Object containing variant information (e.g., color, size)
customer
Type: CustomerData
(optional)Description: Information about the customer for order fulfillment, which may include:
id
: Platform’s unique identifier for the customeremail
: Customer’s email addressfirstName
: Customer’s first namelastName
: Customer’s last namedocument
: Customer’s document or tax ID (e.g., CPF in Brazil)phone
: Customer’s phone numberaddresses
: List of customer’s addresses
Address
Type: Base address interface Description: The core address structure used across the checkout system:
id
: Optional unique identifier for saved addressestype
: Optional address type (“home”, “billing”, “work”, “pick_up”, “other”)street
: Optional street namenumber
: Optional street numbercomplement
: Optional address complement/apartment numberreference
: Optional delivery referenceneighborhood
: Optional neighborhood or districtcity
: Optional city namecountry
: Required country code (e.g., “USA”, “BRA”)stateOrProvince
: Optional state or provincepostalCode
: Required postal code
CustomerAddress
Type: CustomerAddress extends Address
Description: Addresses associated with a customer account, with additional fields:
selected
: Whether this address is currently selectedreceiverName
: Optional name of person receiving deliveries
shipping
Type: ShippingInfo
(optional)Description: Comprehensive shipping information including:
addresses
: List of shipping addresses available for selectionpackages
: List of shipping packages the user has selectedavailableQuotes
: List of shipping options available for user selectionavailableCountries
: List of country codes available for shipping
ShippingAddress
Type: ShippingAddress extends Address
Description: Used specifically for shipping destinations, with additional field:
receiverName
: Optional name of person receiving the package
Shipping Packages
EachShippingPackage
contains:
id
: Unique identifier for the shipping packageitems
: List of cart item indexes included in this packagecarrier
: Name of the shipping carrier (e.g., “FedEx”, “UPS”)method
: Carrier’s shipping method (e.g., “Standard”, “Express”)estimatedDeliveryTime
: Object containing:value
: Numerical value of the estimated delivery timeunit
: Unit of time (e.g., “day”, “hour”, “week”) as Intl.RelativeTimeFormatUnit
price
: Cost of shipping this package in minor unitsaddressId
: ID of the shipping address for this packagetype
: Type of shipping: “delivery” or “pick_up”storeName
: Optional name of store for pickup packagestimeSlot
: Optional time slot selection with:id
: Unique identifier for the time slotoriginalPrice
: Original price for this time slotprice
: Current price for this time slotstartDate
: Start date and time in ISO 8601 formatendDate
: End date and time in ISO 8601 format
Shipping Quotes
EachShippingQuote
(as either DeliveryQuote
or PickUpQuote
) contains:
id
: Unique identifier for the shipping quotecarrier
: Name of the shipping carriername
: Display name of the shipping methodestimatedDeliveryTime
: Object containing:value
: Numerical value of the estimated delivery timeunit
: Unit of time (e.g., “day”, “hour”, “week”) as Intl.RelativeTimeFormatUnit
availableItems
: List of cart item indexes this quote applies toprice
: Cost of this shipping option in minor unitstimeSlots
: Array of available delivery/pickup time slots, each containing:id
: Unique identifier for the time slotoriginalPrice
: Original price for this time slotprice
: Current price for this time slotstartDate
: Start date and time in ISO 8601 formatendDate
: End date and time in ISO 8601 format
type
: Either “delivery” or “pick_up”- For pickup quotes: additional
pickUpInfo
containing:name
: Name of the pickup location/storeaddress
: Full address object containing all standard address fields
payment
Type: PaymentInfo
(optional)Description: Payment details including:
availableMethods
: All payment methods available (credit card, PayPal, etc.)selectedPayments
: Payment method(s) selected by the usertotal
: Total amount to be paid
Payment Methods
EachPaymentMethod
contains:
id
: Unique identifier for the payment methodtype
: Payment method type (e.g., “credit_card”, “debit_card”, “paypal”)name
: Display name of the payment method (e.g., “Visa”, “PayPal”)installments
: Optional array of available payment installment options, each containing:number
: Number of installments (e.g., 1, 3, 6)amount
: Amount of each installment in minor unitstotal
: Total amount across all installments in minor unitsinterestRate
: Optional interest rate percentage for this installment plan
Selected Payments
EachSelectedPayment
contains:
methodId
: ID of the chosen payment method (matching PaymentMethod.id)referenceValue
: Base amount for this payment, typically the sub-totaltotal
: Total amount being paid with this payment method in minor unitsinstallments
: Optional number of installments chosen for this payment
campaign
Type: Campaign
(optional)Description: Marketing or merchandising campaign information:
coupons
: Array of coupon codes applied by the userpromotions
: Array of promotions, each containing:id
: Unique identifier for the promotionname
: Optional display name or descriptiondiscountValue
: Optional total discount amount in minor units
locale
Type: LocaleInfo
Description: Regional settings for the checkout:
currency
: ISO 4217 currency code (e.g., “USD”, “BRL”)language
: Language code (e.g., “en”, “pt-BR”)country
: Country code in ISO 3166-1 alpha-3 format (e.g., “USA”, “BRA”)
taxes
Type: TaxLine[]
(optional)Description: Detailed breakdown of tax lines, each containing:
name
: Name or code of the tax (e.g., “VAT”, “State Tax”)value
: Amount of this tax in minor units
totals
Type: Totals
Description: Comprehensive breakdown of order costs:
items
: Total cost of items in the cartshipping
: (Optional) Total shipping costtax
: (Optional) Total tax amountdiscounts
: (Optional) Total discount amountinterest
: (Optional) Total interest amount (e.g., from installments)total
: Grand total for the checkout
user
Type: User
Description: Information about who is operating the checkout session:
id
: Identifier for the user (customer ID or operator ID)role
: Role of the user:"user"
: The end customer themselves"operator"
: A third party acting on behalf of the customer
isGuest
: Whether the user is not logged in
readOnly
Type: boolean
Description: Indicates if the checkout session is locked from further modification. This could occur when a user was identified but not logged in.
extensions
Type: Extensions
(generic parameter, optional)Description: An extension point where clients can add custom fields for platform-specific or business-specific needs.
Usage Examples
Checking if a session is valid for checkout
Displaying cart totals
Handling multi-package shipping
Related Types
TheCheckoutSession
interface works with several other types:
CartItem
- Information about items in the cartCustomerData
- Customer detailsShippingInfo
- Shipping details and optionsPaymentInfo
- Payment methods and selectionsCampaign
- Promotions and couponsLocaleInfo
- Regional settingsTotals
- Cost breakdownUser
- Information about session operator