Restore a Seat Cart After a Page Reload

Persist a booking-session id, reload the server-held cart, handle expired or frozen states, and show buyers which seats they still own after a refresh.

Two browser-like panels showing the same three highlighted seats after a reload.

After a buyer refreshes a booking page, the map’s last drawn selection is not proof that the seats are still held. Restore from the server. A Seatmap Pro booking session holds seats and general-admission capacity for one event and returns the cart, state and expiry needed to rebuild the page.

The integration sequence

  1. Enable public sessions for the organization. The page cannot create or read them until this is configured. Initialize BookingSessionClient with the booking-service URL and the organization’s public key.
  2. Create once per attempt. Generate and retain a unique idempotency key before calling create(eventId, key). If the response is lost, retry with that same key so the server returns the same session. Store the returned session id where the intended reload can find it. The id is a credential, so limit where the page stores and exposes it.
  3. Hold before marking selected. On a seat click, call lock. Render the cart returned by the server, not the click itself. If the hold is refused, show the conflicting seat and leave any other held lines visible. Use unlock when the buyer removes a line.
  4. Recover on page load. If a stored id exists, call get(sessionId) and verify the event id. Rebuild the page’s visual selection from session.cart.seats and session.cart.groupOfSeats. If the id belongs to another event, do not apply that cart to the current map.

Do not create a second session just because the page reloaded. That would leave the first cart holding seats until its own expiry while the buyer sees a new, empty cart.

For general admission, the lock selection sends the desired total capacity for an area, not an increment. Repeating a request for two places should still mean two places. Include both numbered seats and general-admission capacity when you enforce the session’s maxSeats limit.

Render the returned state, not a remembered state

Session state Page behavior after reload
ACTIVE Restore held lines, total and the remaining time; allow changes.
PENDING_PAYMENT Show the frozen cart and payment return path; do not enable seat editing.
CONFIRMED Show the order result from your platform, not an editable selection.
CANCELLED or EXPIRED Clear the local selection and explain that the hold ended.

The session payload includes serverTime and expiry information. Use them to show a countdown, and call get again when the timer reaches zero. A local timer cannot extend a hold. If get fails after a network interruption, show a temporary verification state instead of claiming the seats are lost or secured.

At payment, checkout freezes the held cart. Your server confirms it after the order succeeds. Test reloads while the cart is active, during payment, after expiry and after confirmation. A page that restores three blue seats but the wrong session state has not restored the buyer’s cart. For a walk-through with your event, book a demo.

Continue reading

All posts →

Change a Held Seat Without Losing the Cart

Handle a seat upgrade with server-held inventory: check cart capacity, hold the replacement, release the old seat, recalculate the total and handle conflicts.