Update customer session

PUT {{baseUrl}}/v2/customer_sessions/:customerSessionId?dry=true&now=2024-11-10T23:00:00Z

Update or create a customer session. The endpoint responds with the potential promotion rule effects that match the current cart. For example, use this endpoint to share the contents of a customer's cart with Talon.One.

Note: The currency for the session and the cart items in the session is the currency set for the Application that owns this session.

Session management

To use this endpoint, start by learning about customer sessions and their states and refer to the state parameter documentation the request body schema docs below.

Sessions and customer profiles

  • To link a session to a customer profile, set the profileId parameter in the request body to a customer profile's integrationId.
  • While you can create an anonymous session with profileId="", we recommend you use a guest ID instead.
  • A profile can be linked to simultaneous sessions in different Applications. Either:
    • Use unique session integration IDs or,
    • Use the same session integration ID across all of the Applications.

Note: If the specified profile does not exist, an empty profile is created automatically. You can update it with Update customer profile.

Performance tips

  • Updating a customer session returns a response with the new integration state. Use the responseContent property to save yourself extra API calls. For example, you can get the customer profile details directly without extra requests.
  • We recommend sending requests sequentially. See Managing parallel requests.

For more information, see: - The introductory video in Getting started. - The integration tutorial.

Request Params

KeyDatatypeRequiredDescription
drybooleanIndicates whether to persist the changes. Changes are ignored when dry=true.

When set to true, you can use the evaluableCampaignIds body property to select specific campaigns to run. | | now | string | | A timestamp value of a future date that acts as a current date when included in the query.

Use this parameter, for example, to test campaigns that would be evaluated for this customer session in the future (say, scheduled campaigns).

Note:

  • It must be an RFC3339 timestamp string.
  • It can only be a date in the future.
  • It can only be used if the dry parameter in the query is set to true. |

Request Body

{"customerSession"=>{"profileId"=>"URNGV8294NV", "storeIntegrationId"=>"STORE-001", "evaluableCampaignIds"=>[10, 12], "couponCodes"=>["XMAS-20-2021"], "referralCode"=>"NT2K54D9", "loyaltyCards"=>["loyalty-card-1"], "state"=>"open", "cartItems"=>[{"name"=>"Air Glide", "sku"=>"SKU1241028", "quantity"=>1, "returnedQuantity"=>1, "remainingQuantity"=>1, "price"=>99.99, "category"=>"shoes", "product"=>{"name"=>"sample_product"}, "weight"=>1130, "height"=>0, "width"=>0, "length"=>0, "position"=>0, "attributes"=>{"image"=>"11.jpeg", "material"=>"leather"}, "additionalCosts"=>{"shipping"=>{"price"=>9}}, "catalogItemID"=>0}], "additionalCosts"=>{"shipping"=>{"price"=>9}}, "identifiers"=>["91.11.156.141"], "attributes"=>{"ShippingCity"=>"Berlin"}}, "responseContent"=>["customerSession", "customerProfile"]}

HEADERS

KeyDatatypeRequiredDescription
Content-Typestring
Acceptstring