Public (no seller session)
These routes intentionally omitrequireSession:
POST /api/embed/checkout(CORS*)GET /api/stores/by-subdomain/{subdomain}/storefrontGET /api/stores/by-subdomain/{subdomain}/productsGET /api/store/{subdomain}POST /api/checkout/startPOST /api/coupons/validatePOST /api/track- Most payment create / verify paths used by checkout UI
Seller / staff session
Dashboard APIs use the Join Markt session cookie established by/api/auth/login. Guards:
requireSession(req)— logged-in user + CSRF when cookie session is used- Store-scoped permissions (
viewOrders,manageCoupons,manageSettings,manageTickets, …)
manageSettings on {storeId}.
Checkout access tokens
Buyer-facing order endpoints accept a checkout token (query / cookie via/api/checkout/enter and /api/checkout/session) or legacy email match. Staff with viewOrders can also read delivery payloads.
Customer session
/api/customer/* and parts of /api/v1/customer-dashboard/* use customer sessions — separate from seller login.
Payment webhooks
Inbound webhooks authenticate with gateway signatures (Stripe signing secret, Cryptomus sign, etc.). They are CSRF-exempt by design. Treat webhook secrets like production credentials.CSRF policy
Cookie CSRF is enforced inside session/admin guards (lib/api/csrf-policy.ts lists exempt prefixes for auth bootstrap, payments, embed-adjacent checkout, /api/v1/*, etc.). Public CORS embed POST does not send a seller CSRF token.
Practical guidance
Never put a seller session cookie into a third-party storefront.