---
id: PlaceOrderCommand
name: Place order
version: 1.0.0
badges:
  - content: Order Lifecycle
    backgroundColor: blue
    textColor: blue
summary: |
  Shared Finance order-placement command consumed by Notification to render
  and submit a new-order email.
schemaPath: schema.json
owners:
  - platform-engineering-team
---

`PlaceOrderCommand` is an asynchronous Kafka integration command published by [[service|order-orchestration]] after checkout and consumed independently by [[service|basket-api]] (to delete the customer's Redis basket) and [[service|notification-api]] (to send a new-order confirmation email). Neither consumer creates or modifies orders in [[service|order-api]].

## Overview

| Property                             | Value                                                                                                                                                |
| :----------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Bounded Context**                  | Platform / Notifications & Shopping                                                                                                                  |
| **Producer**                         | [[service\|order-orchestration]]                                                                                                                     |
| **Consumer(s)**                      | [[service\|basket-api]], [[service\|notification-api]]                                                                                               |
| **Protocol / Format**                | Kafka + CloudEvents JSON (camelCase payload)                                                                                                         |
| **Channel / Topic**                  | [[channel\|bookworm.&#123;env&#125;.finance.place-order]]                                                                                            |
| **Dead-Letter Channel**              | [[channel\|bookworm.&#123;env&#125;.basket.dead-letter-queue]], [[channel\|bookworm.&#123;env&#125;.notification.dead-letter-queue]]                 |
| **Partition Key**                    | `OrderId`                                                                                                                                            |
| **Delivery / Idempotency Guarantee** | At-least-once delivery; [[service\|basket-api]] deduplicates by `OrderId` (24h TTL) and [[service\|notification-api]] deduplicates by `id` (24h TTL) |

:::note
`PlaceOrderCommand` initiates post-checkout basket cleanup and confirmation email delivery only. To submit a new order over HTTP, see [[command|CreateOrder]].
:::

## Payload Fields & Envelope

### Command Payload

| Name           | Type                   | Required | Constraints                                         | Description                                                                                                                                          |
| :------------- | :--------------------- | :------- | :-------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`           | `string` (`uuid`)      | Yes      | UUIDv7                                              | Unique message identifier used for 24-hour Redis deduplication in [[service\|notification-api]]                                                      |
| `creationDate` | `string` (`date-time`) | Yes      | ISO 8601 UTC timestamp                              | UTC timestamp when the command was created                                                                                                           |
| `basketId`     | `string` (`uuid`)      | Yes      | Valid UUID                                          | Buyer/basket identifier deleted from Redis by [[service\|basket-api]] (ignored by [[service\|notification-api]])                                     |
| `orderId`      | `string` (`uuid`)      | Yes      | Valid UUID; Kafka partition key                     | Identifier of the placed order; used as the 24-hour deduplication key by [[service\|basket-api]]                                                     |
| `fullName`     | `string \| null`       | No       | Nullable (defaults to `"Customer"` in Notification) | Customer display name (ignored by [[service\|basket-api]])                                                                                           |
| `email`        | `string \| null`       | No       | Nullable                                            | Recipient email address; forwarded by [[service\|basket-api]] on deletion failure and used by [[service\|notification-api]] (blank/null skips email) |
| `totalMoney`   | `number`               | Yes      | Non-negative monetary amount                        | Order total displayed in the new-order email and echoed in basket cleanup events                                                                     |

## Delivery Guarantees & Error Handling

| Condition                                                  | System Behavior                                                                                                   | Recovery / Compensation                                                                                                    |
| :--------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------- |
| Basket deletion returns `false` in [[service\|basket-api]] | Publishes [[event\|BasketDeletedFailedIntegrationEvent]]                                                          | [[service\|order-orchestration]] instructs [[service\|order-api]] to compensate via [[command\|DeleteBasketFailedCommand]] |
| Transient Redis failure in [[service\|basket-api]]         | Releases the `OrderId` idempotency lock and retries (`50ms`, `250ms`, `1s` with jitter)                           | Exhausted retries route to [[channel\|bookworm.&#123;env&#125;.basket.dead-letter-queue]]                                  |
| Transient SMTP failure in [[service\|notification-api]]    | Retried by the notification resilience pipeline (circuit breaker, exponential backoff with jitter, `30s` timeout) | Exhausted retries route to [[channel\|bookworm.&#123;env&#125;.notification.dead-letter-queue]]                            |
| Blank or `null` `email` in [[service\|notification-api]]   | Consumer returns without error and skips template rendering and SMTP submission                                   | No action required                                                                                                         |

## Related Documentation

- [[service|notification-api]] — Stateless email worker architecture and SMTP configuration.
- [[service|basket-api]] — Redis basket storage and checkout cleanup behavior.
- [[service|order-orchestration]] — Producing orchestration service.
- [[channel|bookworm.&#123;env&#125;.finance.place-order]] — Kafka channel specification.
- [[command|CreateOrder]] — Ordering API HTTP command that creates the order.
- [[event|UserCheckedOutIntegrationEvent]] — Upstream Ordering event that starts checkout orchestration.
- [[event|BasketDeletedCompleteIntegrationEvent]] — Success event published by [[service|basket-api]].
- [[event|BasketDeletedFailedIntegrationEvent]] — Failure event published by [[service|basket-api]].

<NodeGraph />

<SchemaViewer file="schema.json" title="Place order schema" maxHeight="500" search="true" />


 ## Raw Schema:schema.json

{
	"$schema": "https://json-schema.org/draft/2020-12/schema",
	"title": "PlaceOrderCommand",
	"type": "object",
	"additionalProperties": false,
	"required": ["id", "creationDate", "basketId", "orderId", "totalMoney"],
	"properties": {
		"id": { "type": "string", "format": "uuid" },
		"creationDate": { "type": "string", "format": "date-time" },
		"basketId": { "type": "string", "format": "uuid" },
		"orderId": { "type": "string", "format": "uuid" },
		"fullName": { "type": ["string", "null"] },
		"email": { "type": ["string", "null"] },
		"totalMoney": { "type": "number" }
	}
}
