Guest Checkout

Customers can place orders without creating an account. Guest checkout simplifies the purchase process for first-time buyers.


How Guest Checkout Works

  1. A visitor browses your store and adds items to their cart
  2. The cart is tracked by a guest session ID (stored in localStorage)
  3. At checkout, the customer provides their email, name, and shipping details
  4. The order is created with customerId = null and the guest email attached
  5. The customer receives order confirmation at their email

Guest Sessions

When a visitor first arrives, the storefront generates a session ID:

const sessionId = localStorage.getItem('guest_session_id') || crypto.randomUUID()
localStorage.setItem('guest_session_id', sessionId)

This session ID is sent with cart and order requests. The backend:

  • Creates the cart with guestSessionId instead of customerId
  • Sets an expiry on the guest cart (auto-cleanup)
  • Associates the order with the guest email

Order Lookup

Guest customers can look up their order with the order number and email:

GET /api/v1/{storePublicId}/orders/lookup?orderNumber=ORD-20260405-a3f2&email=customer@example.com

Both values must match for security — no data is leaked by guessing order numbers.


Guest Cart Expiry

Guest carts expire automatically after a configurable time. When a cart expires:

  • Reserved inventory is released
  • The cart is no longer accessible

Authenticated users' carts do not expire.


Storefront Integration

The CartProvider on the storefront handles guest sessions automatically. No additional configuration needed — just include guest email at checkout:

<CheckoutForm>
  <TextField>
    <TextFieldLabel>Email</TextFieldLabel>
    <TextFieldInput type="email" name="guestEmail" />
  </TextField>
  {/* ... shipping, payment ... */}
  <CartCheckoutTrigger />
</CheckoutForm>