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

Read the architecture guide →

Create order

Creates an Order for the authenticated Buyer using the current basket and Catalog pricing.

Order Lifecycle
POST/api/v1/orders

CreateOrder creates a New order in 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 (POST /ordering/api/v1/orders) for the authenticated buyer by reading the caller’s active basket 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 and resolving current prices from 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 over gRPC.

Overview

PropertyValue
Bounded ContextOrdering
Owner ServiceOrder 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
Protocol / FormatHTTP POST, application/json UUID response
Gateway EndpointPOST /ordering/api/v1/orders (service path /api/v1/orders)
Authentication & AuthorizationMicrosoft Entra ID JWT — customer or admin role plus scopes ordering_read, ordering_write
Idempotency / ConcurrencyRequired x-request-id header (Redis-backed 3600s TTL; returns 409 Conflict on duplicate); per-buyer Redis distributed lock (order-create:{userId}, 1-minute TTL)
Rate Limit / CachingGlobal concurrency (100), per-IP fixed-window (30 req/min), and per-user token bucket (30 burst, 20 per 10s, queue 5)
Contract Version1.0.0 (ApiVersions.V1)

Request & Response Contract

Request Headers

Accepts no request body; basket items and unit prices are resolved server-side.

NameTypeRequiredConstraintsDescription
x-request-idstringYesNon-empty, non-whitespaceClient-generated idempotency key tracked in Redis for 3600 seconds

Success Response (201 Created)

NameTypeRequiredConstraintsDescription
Location headerstringYesRelative path /api/v1/orders/{id}URI to fetch the created order
Root bodystring (uuid)YesUUIDv7Newly created order identifier

Behavior & Side Effects

  • Server-side basket and price resolution: Fetches the buyer’s basket via Get basket over gRPCQueryv1.0.0Get basket over gRPCReturns the current basket through the basket.v1 gRPC contract.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs (10s deadline) and resolves authoritative book pricing (priceSale ?? price) via Get books over gRPCQueryv1.0.0Get books over gRPCReturns multiple Catalog books by identifier through the book.v1 gRPC contract.Ownercatalog-experience-teamSchemaDiagramOpen docs (10s deadline). Missing catalog books return 404 Not Found.
  • Distributed per-buyer lock: Acquires a 1-minute Redis distributed lock (order-create:{userId}) to prevent concurrent checkouts by the same buyer (409 Conflict if already held).
  • Persistence and event pipeline: Saves 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 New status, appends the placement event to the event store, and publishes 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 via transactional outbox to User Checkout Event ChannelChannelv1.0.0User Checkout Event ChannelKafka topic owned by the commerce-fulfillment-team carrying Order API checkout events that initiate Finance post-checkou...Ownercommerce-fulfillment-teamOpen docs (partitioned by OrderId) to start 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.
  • Idempotency key lifecycle: Claims x-request-id in Redis for 3600 seconds (409 Conflict on replay) and deletes the key if the operation fails with 5xx.
Note

Get basket over gRPCQueryv1.0.0Get basket over gRPCReturns the current basket through the basket.v1 gRPC contract.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs returns an empty response when no basket exists rather than NotFound, and CreateOrder does not reject an empty item list—an empty basket proceeds to persistence and returns 201 Created if saved.

Error Responses

Status / CodeConditionClient Recovery Action
400 Bad RequestMissing or whitespace x-request-id header, or non-UUID NameIdentifier claimProvide a non-empty x-request-id header and valid token claims; do not retry unchanged
401 UnauthorizedMissing, expired, or invalid Entra ID bearer tokenAcquire a fresh Entra ID access token and retry
403 ForbiddenCaller lacks customer/admin role or ordering_read/ordering_write scopesRequest the required Entra ID role and scopes before retrying
404 Not FoundOne or more basket book IDs do not exist in 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 docsRefresh the customer’s basket to remove unavailable items before retrying with a new x-request-id
409 ConflictDuplicate x-request-id within the 3600-second TTL, or concurrent checkout lock held for the same buyerWait for the in-flight checkout to finish and query order history before retrying
429 Too Many RequestsRate limit quota exceeded (Retry-After header included)Wait for the Retry-After interval before retrying
500 Internal Server ErrorUpstream gRPC timeout/error or persistence failureRetry with backoff; the Redis idempotency key is cleared on 5xx

Create order schema

1 property

Required request header for creating an Order. The operation has no request body.

x-request-idstring
required

Idempotency key for the Order creation request.