Ucp cart

From OrcaQubits/agentic-commerce-skills-plugins · View interactive version

Ucp cart is an AI agent skill from the GitHub repository OrcaQubits/agentic-commerce-skills-plugins. Implement the UCP Cart capability (`dev.ucp.shopping.cart`) — a lightweight CRUD surface for collecting line items before purchase intent exists, and its conversion into a Checkout session. Use when building pre-checkout item collection, shareable carts, or cart-recovery flows over REST, MCP, or Emb

How to use this skill

Skill file

UCP Cart Capability

Before writing code

Fetch live spec: Web-search site:ucp.dev specification shopping cart and fetch the page for the exact Cart schema, operation names, and binding details. Also fetch https://ucp.dev/latest/schemas/shopping/cart.json for the authoritative JSON Schema. Field names and required-ness change between spec versions — never write the schema from memory.

Conceptual Architecture

Why Cart is separate from Checkout

Checkout carries payment handler configuration, buyer commitment, and a status lifecycle. That is overhead a buyer does not need while still browsing. Cart is the lightweight half: collect items, get estimated totals, share a link — with no payment configuration and no status machine.

The canonical progression is:

cart session  →  checkout session  →  order

Cart handles exploration. Checkout enforces commitment.

Operations

| Operation | Purpose |

|-----------|---------|

| Create Cart | Initialize a session with line items and optional buyer / context data |

| Get Cart | Read current state; returns not_found once expired or cancelled |

| Update Cart | Full replacement of cart contents — not a patch |

| Cancel Cart | Terminate the session |

Update Cart replacing rather than merging is the detail most implementations get wrong. Send the complete intended line-item set every time.

Key data model

State model

Carts are binary: they exist or they do not. There is no incomplete → completed lifecycle, and totals stay estimates until checkout conversion. Treat any amount read from a cart as indicative only — never as something to charge against.

Conversion to Checkout

Create a checkout referencing cart_id. Two rules govern this:

  1. The business uses the cart contents and ignores overlapping payload fields. Do not attempt to pass line items alongside a cart_id and expect them to merge.
  2. Conversion is idempotent — if an incomplete checkout already exists for that cart, the business returns the existing session rather than creating a second one.

After checkout completion the business may clear the cart, driven by TTL or its own business logic. Do not depend on the cart surviving.

Bindings

Cart is exposed over REST, MCP, and Embedded. It is not an A2A capability. Negotiate it like any other capability — see ucp-dev-patterns for the intersection algorithm.

Implementation Guidance

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.