---
id: DeleteBasketCompleteCommand
name: Acknowledge basket deletion completed
version: 1.0.0
badges:
  - content: Order Lifecycle
    backgroundColor: blue
    textColor: blue
summary: |
  Reports Finance's successful basket-cleanup outcome to Order API without
  changing the Order's business status.
owners:
  - commerce-fulfillment-team
schemaPath: schema.json
---

`DeleteBasketCompleteCommand` (v1.0.0) is an asynchronous Kafka integration command published by [[service|order-orchestration]] to inform [[service|order-api]] that post-checkout basket cleanup succeeded. [[service|order-api]] logs the outcome for operational visibility without modifying the order's business status.

## Overview

| Property                             | Value                                                                          |
| :----------------------------------- | :----------------------------------------------------------------------------- |
| **Bounded Context**                  | Ordering                                                                       |
| **Producer**                         | [[service\|order-orchestration]]                                               |
| **Consumer(s)**                      | [[service\|order-api]]                                                         |
| **Protocol / Format**                | Kafka + CloudEvents JSON (camelCase payload)                                   |
| **Channel / Topic**                  | [[channel\|bookworm.&#123;env&#125;.finance.delete-basket-complete]]           |
| **Dead-Letter Channel**              | [[channel\|bookworm.&#123;env&#125;.ordering.dead-letter-queue]]               |
| **Partition Key**                    | `OrderId`                                                                      |
| **Delivery / Idempotency Guarantee** | At-least-once delivery; consumer is side-effect-free (structured logging only) |

:::note
`DeleteBasketCompleteCommand` is distinct from [[event|BasketDeletedCompleteIntegrationEvent]]. [[service|basket-api]] publishes `BasketDeletedCompleteIntegrationEvent` to [[service|order-orchestration]], which then publishes `DeleteBasketCompleteCommand` to [[service|order-api]].
:::

## Payload Fields & Envelope

### Command Payload

| Name           | Type                   | Required | Constraints                                           | Description                                            |
| :------------- | :--------------------- | :------- | :---------------------------------------------------- | :----------------------------------------------------- |
| `id`           | `string` (`uuid`)      | Yes      | UUIDv7                                                | Unique identifier assigned to the integration message  |
| `creationDate` | `string` (`date-time`) | Yes      | ISO 8601 UTC timestamp                                | UTC timestamp when the command was created             |
| `orderId`      | `string` (`uuid`)      | Yes      | Valid UUID; Kafka partition key; PII-redacted in logs | Identifier of the order whose basket cleanup succeeded |
| `totalMoney`   | `number`               | Yes      | Non-negative monetary amount                          | Total purchase amount associated with the order        |

## Delivery Guarantees & Error Handling

| Condition                             | System Behavior                                                                 | Recovery / Compensation                                                                      |
| :------------------------------------ | :------------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------- |
| Duplicate delivery                    | Consumer logs the message again with no database or status side effects         | Naturally idempotent (no state mutation)                                                     |
| Activity publish failure in producer  | Durable orchestration retries up to 3 times (`5s` initial delay, `2.0` backoff) | Runs LIFO saga compensations if all retries fail                                             |
| Deserialization or processing failure | Retried with cooldown (`50ms`, `250ms`, `1s` with full jitter)                  | Exhausted messages route to [[channel\|bookworm.&#123;env&#125;.ordering.dead-letter-queue]] |

## Related Documentation

- [[service|order-api]] — Consuming service and Kafka setup.
- [[service|order-orchestration]] — Producing orchestration service.
- [[channel|bookworm.&#123;env&#125;.finance.delete-basket-complete]] — Kafka topic specification.
- [[channel|bookworm.&#123;env&#125;.ordering.dead-letter-queue]] — Dead-letter queue for failed Ordering consumers.
- [[command|DeleteBasketFailedCommand]] — Companion compensation command that soft-deletes the order.
- [[event|BasketDeletedCompleteIntegrationEvent]] — Upstream event from [[service|basket-api]].

<NodeGraph />

<SchemaViewer
	file="schema.json"
	title="Acknowledge basket deletion completed schema"
	maxHeight="500"
	search="true"
/>


 ## Raw Schema:schema.json

{
	"$schema": "https://json-schema.org/draft/2020-12/schema",
	"title": "DeleteBasketCompleteCommand",
	"type": "object",
	"additionalProperties": false,
	"required": ["id", "creationDate", "orderId", "totalMoney"],
	"properties": {
		"id": {
			"type": "string",
			"format": "uuid",
			"description": "Unique identifier assigned to the integration message."
		},
		"creationDate": {
			"type": "string",
			"format": "date-time",
			"description": "UTC timestamp when the integration message was created."
		},
		"orderId": {
			"type": "string",
			"format": "uuid",
			"description": "Identifier of the Order whose basket cleanup completed."
		},
		"totalMoney": {
			"type": "number",
			"format": "double",
			"description": "Total purchase amount associated with the Order."
		}
	}
}
