CheckoutSessions
The purchase saga (CheckoutSession).
Introduction
REST contract of the checkout bounded context of the digital storefront, derived from storefront/model/model.yaml (contexts[checkout].rest) and the final model-gap decisions H1-H10. Checkout is the purchase saga: OPEN -> AUTHORIZING -> PLACING -> COMPLETED, with DECLINED (another token may be tried while the price quote is valid), REQUOTE_REQUIRED and FAILED (both carry a void that is retried until it succeeds), and EXPIRED (from OPEN or DECLINED). Authorize before placing (compensatable: void), place the order through customer-ordering POST /checkout (the pivot, via an Anti-Corruption Layer), then retriable steps via events. PLACING is the semantic lock: while the place-order outcome is unknown there is no void and no new attempt; the session answers 202 and the BFF polls. The session stores shopperId and shipToAddressId references, never PII, and the stored placement request is PII-free so ResolveInDoubtPlacements can replay it byte for byte with the same Idempotency-Key (alert at 20 h, give up and void at 22 h, before the network's 24 h idempotency window). Errors are RFC 9457 problem details (application/problem+json) whose type is /problems/<slug>; shared types are not-found (404), illegal-transition (409), concurrent-update (409) and validation-failed (422), plus one kebab-case slug per Err of the model. Every POST takes an Idempotency-Key header (1-128 printable ASCII characters): a missing or malformed key is 400 idempotency-key-required / idempotency-key-invalid, a repeat of the same method, path and body replays the stored answer for 24 hours with the response header Idempotency-Replayed: true, and the same key on a different request whose answer was stored is 409 idempotency-key-reused. A 2xx is stored; so is a refusal that is final for the request (malformed-request, session-closed, price-quote-expired) or that committed state (authorization-mismatch: the session was saved DECLINED before the answer). A refusal that a retry can pass is NOT stored and its key is released, so the same Idempotency-Key runs the request again and another body under it is a new request: not-found, cart-not-checkout-ready, placement-in-doubt, void-pending, concurrent-update, illegal-transition, offer-not-quotable, validation-failed and price-quote-rejected, like every 5xx (never stored). The Idempotency-Key is global to the service, not per route. A request body over 64 KiB, malformed JSON, an unknown field or a NUL character (U+0000) in the query string or body is 400 malformed-request; a NUL in the path, or a path identifier longer than 128 characters, is 404. Every error body carries type, title, status, detail and instance. No authentication.
CheckoutSessions
CheckoutSessions
Confirm the session with a payment method token
ConfirmSession with the PSP payment method token (never a card number). AUTHORIZING calls customer-payments POST /payment-authorizations (key `<sessionId>:auth:<attempt>`, the attempt counter grows on every retry after a decline; allocations per group); the authorized amount must equal the quote total (ErrAuthorizationMismatch). PLACING persists the placement request and calls customer-ordering POST /checkout with Idempotency-Key equal to the sessionId. Outcomes: 200 with the session in a definitive state (COMPLETED, DECLINED, REQUOTE_REQUIRED with requotedOffers after a successful void, or FAILED after a void plus an alert for a contract bug); 202 while the place-order outcome is unknown (the session stays PLACING; poll GET /checkout-sessions/{sessionId}). A DECLINED session may be confirmed again with another token while the price quote is valid.
Get a checkout session
GetSession. While PLACING after an in-doubt placement this is the polling endpoint the BFF uses until a definitive outcome.
Open a checkout session for a cart
OpenSession. Reads the cart snapshot (shopping-cart GET /carts/{cartId}), checks every selected offer is still QUOTED with margin (delivery-promise GET /delivery-offers/{offerId}), issues the binding PriceQuote (pricing POST /price-quotes) and opens the session. The BFF then shows the review page with the binding total. shipToAddressId references a saved address held by customer-ordering (NG1); the address itself never enters the storefront.