Storefront has been decoupled into micro-frontends with a dedicated commerce app and shared shell.

Read the architecture guide →

Create and manage Orders

Create an Order from the current basket, retrieve it, and request a valid lifecycle transition.

Guide

Audience & Outcome: This guide is for frontend developers, API integrators, and backend engineers working with Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle, creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs. You will learn how checkout locks purchase snapshots, enforces idempotency, and governs one-way order status transitions.

Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle, creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs converts a customer’s mutable shopping basket into a durable, price-locked purchase record in Order DatabaseContainerv1.0.0Order DatabaseAuthoritative PostgreSQL system of record owned by the Ordering bounded context for buyers, accepted orders, purchase-ti...Ownercommerce-fulfillment-teamDiagramOpen docs and governs its commercial lifecycle (New, Completed, or Cancelled). Separating order acceptance from downstream basket cleanup and email notifications keeps checkout fast while preserving an authoritative audit trail.

Context and motivation

Checkout crosses four bounded contexts: Shopping holds mutable pre-order items, Catalog owns live book metadata and pricing, Ordering records accepted commercial commitments, and Finance coordinates asynchronous post-checkout cleanup and notification requests.

Without strict boundaries at checkout, three failure modes occur:

How it works

Customers interact with checkout through the Commerce microfrontend, which routes authenticated requests through the API Gateway to Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle, creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs. Every order endpoint requires a valid Microsoft Entra ID JWT (customer or admin role with ordering_read/ordering_write scopes) and applies per-user token-bucket rate limiting (30 token limit, 20 tokens per 10s, returning 429 Too Many Requests).

The visual below shows synchronous checkout validation, order persistence, and asynchronous handoff to Order OrchestrationServicev1.0.0Order OrchestrationMessage-driven Finance workflow service that coordinates post-checkout basket cleanup and order notifications using Dura...PublishesPlaceOrderCommand, DeleteBasketCompleteCommand +3SubscribesUserCheckedOutIntegrationEvent, OrderStatusChangedToCompleteIntegrationEvent +3APIsAsyncAPIOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs.

Loading graph...

Order creation and snapshot locking

  1. Caller identity and idempotency check

    When a customer submits POST /api/v1/orders with a unique x-request-id header, Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle, creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs derives the BuyerEntityv1.0.0BuyerRepresents a customer's ordering profile and delivery address within the Ordering bounded context.Ownercommerce-fulfillment-teamOpen docs strictly from the authenticated Entra ID token and stores a 1-hour idempotency marker in Order Cache and Distributed LocksContainerv1.0.0Order Cache and Distributed LocksRedis-backed coordination and caching slice owned by the Ordering bounded context for buyer-scoped creation locks, HTTP ...Ownercommerce-fulfillment-teamDiagramOpen docs. Reusing the same x-request-id returns 409 Conflict (unless an unhandled error clears the marker for safe retry).

  2. Basket read and price snapshot

    Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle, creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs reads the BasketEntityv1.0.0BasketCustomer-scoped, mutable pre-order collection of requested books and quantities managed prior to checkout.Ownercommerce-fulfillment-teamOpen docs from Basket APIServicev1.0.0Basket APIInternal HTTP and gRPC service for managing customer-scoped shopping baskets, Catalog price enrichment, and post-checkou...PublishesGetBookGrpc, GetBooksGrpc +2SubscribesCreateBasket, UpdateBasket +4APIsOpenAPI, AsyncAPIOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs over gRPC, resolves every BookEntityv1.0.0BookCanonical sellable title in the product catalog, encapsulating descriptive metadata, pricing, stock availability, taxono...Ownercatalog-experience-teamOpen docs via Catalog APIServicev1.0.0Catalog APIInternal HTTP and gRPC service for Catalog product management, hybrid discovery, and authoritative book metadata. PublishesBookUpdatedRatingFailedIntegrationEventSubscribesCreatePublisher, UpdatePublisher +24APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs gRPC, locks in each item’s unit price, and calculates the order total from those recorded line totals.

  3. Serialized persistence and outbox handoff

    A 1-minute distributed lock in Order Cache and Distributed LocksContainerv1.0.0Order Cache and Distributed LocksRedis-backed coordination and caching slice owned by the Ordering bounded context for buyer-scoped creation locks, HTTP ...Ownercommerce-fulfillment-teamDiagramOpen docs serializes concurrent writes for the same buyer before persisting the OrderEntityv1.0.0OrderDurable purchase record owned by a Buyer, capturing immutable purchase-time line items and governing order lifecycle tra...Ownercommerce-fulfillment-teamOpen docs in Order DatabaseContainerv1.0.0Order DatabaseAuthoritative PostgreSQL system of record owned by the Ordering bounded context for buyers, accepted orders, purchase-ti...Ownercommerce-fulfillment-teamDiagramOpen docs with status New and publishing User checked outEventv1.0.0User checked outReports that an Order was placed and its checkout details are ready for Finance coordination. Ownercommerce-fulfillment-teamSchemaDiagramOpen docs through the transactional outbox.

    Note

    Returning 201 Created confirms only that Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle, creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs accepted and persisted the order snapshot. Basket deletion and email notifications run asynchronously under Order OrchestrationServicev1.0.0Order OrchestrationMessage-driven Finance workflow service that coordinates post-checkout basket cleanup and order notifications using Dura...PublishesPlaceOrderCommand, DeleteBasketCompleteCommand +3SubscribesUserCheckedOutIntegrationEvent, OrderStatusChangedToCompleteIntegrationEvent +3APIsAsyncAPIOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs.

Order status lifecycle and event history

Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle, creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs enforces a strict one-way state machine for business status:

Loading graph...