---
id: UserCheckedOutIntegrationEvent
name: User checked out
version: 1.0.0
summary: |
  Reports that an Order was placed and its checkout details are ready for
  Finance coordination.
owners:
  - commerce-fulfillment-team
schemaPath: schema.json
badges:
  - content: Order Lifecycle
    backgroundColor: blue
    textColor: blue
---

`UserCheckedOutIntegrationEvent` (v1.0.0) reports that [[service|order-api]] accepted and persisted a new [[entity|order]] during customer checkout. [[service|order-orchestration]] consumes this event to start a Durable Task saga instance, which dispatches [[command|PlaceOrderCommand]] to [[service|basket-api]] (for basket cleanup) and [[service|notification-api]] (for order confirmation email). Receiving this event confirms order placement only, not basket cleanup or order completion.

## Overview

| Property                             | Value                                                                                               |
| :----------------------------------- | :-------------------------------------------------------------------------------------------------- |
| **Bounded Context**                  | Ordering                                                                                            |
| **Producer**                         | [[service\|order-api]]                                                                              |
| **Consumer(s)**                      | [[service\|order-orchestration]]                                                                    |
| **Protocol / Format**                | Kafka + CloudEvents JSON (camelCase payload)                                                        |
| **Channel / Topic**                  | [[channel\|bookworm.&#123;env&#125;.ordering.user-checked-out]]                                     |
| **Dead-Letter Channel**              | [[channel\|bookworm.&#123;env&#125;.ordering.dead-letter-queue]]                                    |
| **Partition Key**                    | `OrderId`                                                                                           |
| **Delivery / Idempotency Guarantee** | Published via transactional outbox (at-least-once); orchestration starts idempotently per `OrderId` |

## Payload Fields & Envelope

### Event Payload

| Name           | Type                   | Required | Constraints                     | Description                                                                         |
| :------------- | :--------------------- | :------- | :------------------------------ | :---------------------------------------------------------------------------------- |
| `id`           | `string` (`uuid`)      | Yes      | UUIDv7                          | Unique identifier for this integration event instance                               |
| `creationDate` | `string` (`date-time`) | Yes      | ISO 8601 UTC timestamp          | UTC timestamp when the event was created                                            |
| `orderId`      | `string` (`uuid`)      | Yes      | Valid UUID; Kafka partition key | Identifier of the accepted order                                                    |
| `basketId`     | `string` (`uuid`)      | Yes      | Valid UUID                      | Buyer-linked basket reference supplied by the producer                              |
| `fullName`     | `string \| null`       | Yes      | Nullable string                 | Customer full name when available on the buyer record                               |
| `email`        | `string \| null`       | Yes      | Nullable email format           | Customer email address when available; used to decide whether to send notifications |
| `totalMoney`   | `number`               | Yes      | Non-negative monetary amount    | Total purchase amount associated with the accepted order                            |

:::note
The current producer populates `basketId` with the order's `BuyerId`. Downstream consumers must not treat `basketId` as an independently resolved [[service|basket-api]] record.
:::

### CloudEvents Envelope Headers

| Header        | Value / Source                                      | Purpose                                                                |
| :------------ | :-------------------------------------------------- | :--------------------------------------------------------------------- |
| `messagetype` | `BookWorm.Contracts.UserCheckedOutIntegrationEvent` | Explicit message identity for cross-service deserialization            |
| `source`      | `urn:bookworm:bookworm-ordering`                    | Identifies the producing service                                       |
| `requestid`   | Propagated from `POST /ordering/api/v1/orders`      | Correlates checkout across Ordering, Finance, Basket, and Notification |

## Delivery Guarantees & Error Handling

| Condition                               | System Behavior                                                                                                                 | Recovery / Compensation                                                                             |
| :-------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------ | :-------------------------------------------------------------------------------------------------- |
| `email` or `fullName` is `null`         | Payload remains valid; [[service\|order-orchestration]] still coordinates basket cleanup and evaluates notification eligibility | Consumers must tolerate `null` contact fields without failing deserialization                       |
| Transient broker or orchestration error | Transactional outbox guarantees at-least-once publication; orchestration starts idempotently per `OrderId`                      | Inspect orchestration task hub and [[channel\|bookworm.&#123;env&#125;.ordering.dead-letter-queue]] |

## Related Documentation

- [[service|order-api]] — Producer service.
- [[service|order-orchestration]] — Consumer orchestration service.
- [[channel|bookworm.&#123;env&#125;.ordering.user-checked-out]] — Kafka channel specification.
- [[channel|bookworm.&#123;env&#125;.ordering.dead-letter-queue]] — Dead-letter queue for failed Ordering consumers.
- [[event|OrderStatusChangedToCompleteIntegrationEvent]] — Subsequent completion event.
- [[event|OrderStatusChangedToCancelIntegrationEvent]] — Subsequent cancellation event.
- [[entity|order]] — Ordering aggregate schema and lifecycle.

<NodeGraph />

<SchemaViewer file="schema.json" title="User checked out schema" maxHeight="500" search="true" />


 ## Raw Schema:schema.json

{
	"$schema": "https://json-schema.org/draft/2020-12/schema",
	"title": "UserCheckedOutIntegrationEvent",
	"type": "object",
	"additionalProperties": false,
	"required": ["id", "creationDate", "orderId", "basketId", "fullName", "email", "totalMoney"],
	"properties": {
		"id": {
			"type": "string",
			"format": "uuid",
			"description": "Unique identifier assigned to the integration event."
		},
		"creationDate": {
			"type": "string",
			"format": "date-time",
			"description": "UTC timestamp when the integration event was created."
		},
		"orderId": {
			"type": "string",
			"format": "uuid",
			"description": "Identifier of the Order."
		},
		"basketId": {
			"type": "string",
			"format": "uuid",
			"description": "UUID serialized as basketId. The current EventMapper supplies the\nOrder's BuyerId for this field.\n"
		},
		"fullName": {
			"type": ["string", "null"],
			"description": "Customer name, when available."
		},
		"email": {
			"type": ["string", "null"],
			"format": "email",
			"description": "Customer email, when available."
		},
		"totalMoney": {
			"type": "number",
			"format": "double",
			"description": "Total purchase amount associated with the Order."
		}
	}
}
