Route protection
A route guard should distinguish authentication state from an upstream API failure.- anonymous session → redirect to login or open authentication
- logged-in session → render account content
- token/session failure → recover session or require login
- transient Commerce Engine failure → show retry/error state, not an automatic logout
Identity helpers
Many customer and order SDK methods resolve the current user or customer from the active session:getUserId() and getCustomerId() according to the operation contract rather than assuming they are always interchangeable.
Profile
Retrieve the current user:Profile UX
- show which contact methods are verified
- preserve form input on validation failure
- disable duplicate submissions
- update local/session user state from the returned data
- do not expose internal IDs unnecessarily
Address book
List saved addresses:- invalidate the address list
- preserve default billing/shipping constraints
- check whether an active subscription or other feature references the address before deletion if the API exposes such a restriction
- show a confirmation for destructive actions
Address book lifecycle
Order history
- order number
- order date
- current status
- payable/paid amount and currency
- a representative item image
- shipment or payment attention state where relevant
Order detail
- ordered items and quantities
- billing and shipping addresses
- pricing, discounts, tax, shipping, and payment totals
- payment state
- fulfilment and shipment state
- cancellation/refund state
Payment status and retry
A failed payment can remain retryable:is_retry_available is true. Use the same provider-specific payment payload rules as checkout and verify the final result through payment-status polling.
Do not trust old redirect parameters when rendering order payment state.
Cancellation
Fetch the latest order detail immediately before showing or executing cancellation. Show the action only whenis_cancellation_allowed is true.
Order history and conditional cancellation
Returns
Customer-initiated storefront returns are not currently the default supported flow described by the Commerce Engine skills. Returns are managed by store administrators through the Admin Portal, while customers can cancel an eligible order before the cancellation window closes. Do not generate a “Request Return” form unless the store has a verified custom return API or workflow. Explain the store’s support route and show refund/return status supplied by the order APIs.Refunds and payments
Loyalty
- current tier
- available/redeemable balance
- total earned and redeemed
- expiry where supplied
- activity history
Reviews
List the customer’s existing reviews and eligible purchases:Notification preferences and profile image
These features use auth profile operations and may require explicit user IDs or multipart uploads.- retrieve current preferences before editing
- separate transactional requirements from optional marketing consent
- preserve channel-specific consent
- validate image type/size before upload
- remove cached profile image after replacement/deletion
Data fetching and cache boundaries
- server-render stable account summaries where the framework supports request sessions
- use client queries for interactive tabs and mutations
- do not cache one user’s account response globally
- key caches by operation and authenticated session where necessary
- remove protected data immediately after logout
- refetch order/cart state after login because the anonymous cart can merge
Empty and failure states
Keep valid empty states separate from authentication or upstream errors.
Accessibility
- use headings and landmarks across account sections
- identify current navigation tab
- announce mutation success/failure
- require confirmation for delete/cancel actions
- return focus after dialogs close
- make shipment timelines and statuses understandable without colour alone
- expose tracking links with descriptive labels
Production checklist
Orders skill and exact contracts
Use the orders skill for lifecycle decisions and retrieve exact methods/types from the LLM-first reference.