How a shopping session works

Last updated ยท Page 4 of 6

A search_offers or get_offer call that carries no token starts a shopping session, which LivingSocial calls a journey. Its answer carries a journey.token: a standard LivingSocial API token (grpn_...) that stands for this session, the way a browser's cookie would, without a browser. The server shows the token once, in the answer to that call. The assistant passes it as journeyToken on every later call, so LivingSocial knows the calls belong together and keeps one cart for them.

The cart is the person's. Whatever the assistant puts in it with add_to_cart is what the person sees when they open cartUrl (the cart page on LivingSocial): the link carries its own key, which opens only this cart and its checkout, never the session's purchase codes or the person's account. The page takes the key from the link, drops it from the address and uses it for the cart's calls, so the assistant and the person share one cart. When the person links their account, the client gets a session of its own that acts for the account: its cart is the account's cart.

  • Only search_offers and get_offer start a journey. get_journey, get_cart, add_to_cart, update_cart, remove_from_cart, hold_slot, get_purchase_status, cancel_purchase and prepare_checkout need a journeyToken and never start one. Without it they answer journey_required.
  • The token is private to the person. Anyone who holds it can carry on that session and open its cart, so it does not belong in a summary, a share link or a message to someone else. cartUrl does not carry it: give the person that link and keep the token to yourself.
  • A client connected with the token in its Authorization header (above) carries the session in the connection: its tools take no journeyToken, and no answer carries journey.token.
  • A token that LivingSocial does not recognise, or that has expired, answers journey_invalid. The same token will be refused again. Explain that access to this cart was lost; start a new session only if the person wants to start again. Never present the new session's empty cart as their previous cart.