# Session

An object representing a session.

# Properties

Property Type Description
showPricesIncludingVat boolean Whether the price of an article has VAT included.
currency string The currency that the customer want prices to be shown in, as a three letter ISO 4217 code.
customer integer The unique identifier of the logged-in customer.
order integer The order that is connected to this session.

# Methods

# delete

Deletes the session with all its stored data.

# Errors

Code Message Description
-32602 Invalid params If the unique identifier of the session does not exist.

# Example

Session.delete()

# get

Fetches information about a session.

# Parameters

Which info to return. See Query language.

# Example

Session.get("showPricesIncludingVat")

# getOrder

Retreives data from an active cart (Order) tied to the current session.

# Parameters

Parameter Description
query As to Order.get

# Returns

Order data or null if there is no cart in the session.

# Example

Session.getOrder("uid")

# getSchema

Fetches the JSON Schema which can be used for client-side validation.

# getToken

Fetches a token for a customer's session. The session may be tied to a cart.

# Returns

The token to be used as context parameter "session".

# Example

Session.getToken()

# set

Sets session information. If the session has an order and the patch contains a currency, then the prices in the order (including rounding) are updated in the new currency.

# Parameters

Parameter Description
patch An object containing the properties and values to set for the session.
query A query specifying what to return after a successful set (optional).

# Example

Session.set({
  "currency": "EUR"
}, [
  "currency"
])

# setCustomer

Sets a new Customer on the session and associated orders.

# Parameters

The unique identifier of a Customer.

# Example

Session.setCustomer(12341234)