Skip to content

Session Service

The session service is what creates and handles the creation, retrieval, updating and clearing of the UmbCheckout Basket within the .NET session.

You can access the session service by injecting ISessionService which can be found within the namespace UmbCheckout.Core.Interfaces

A shopper has one Basket per site root culture and currency (see Prices, Currencies and Baskets). The overloads without a culture or currency use the current page’s.

Gets the current UmbCheckout session from the .NET session (and, on licensed sites, from the cookie or database). A Basket whose checkout session has been paid is cleared and an empty one returned (see Payment Flow / Lifecycle).

Parameters:

Name Detail
siteRootCulture Optional: the culture of the site root
currencyCode Optional: the 3-letter ISO currency code of the Basket
Task<UmbCheckoutSession> Get();
Task<UmbCheckoutSession> Get(string? currencyCode);
Task<UmbCheckoutSession> Get(string? siteRootCulture, string? currencyCode);

Updates the current UmbCheckout session or create a new session if not found

Parameters:

Name Detail
basket The Basket
Task<UmbCheckoutSession> Update(Basket basket);

Clears the UmbCheckout session from the .NET session. Returns true when the Basket is still present afterwards.

Task<bool> Clear();
Task<bool> Clear(string? currencyCode);
Task<bool> Clear(string? siteRootCulture, string? currencyCode);