Cart Capability
Overview
The Cart capability enables basket building without the complexity of checkout. While Checkout manages payment handlers, status lifecycle, and order finalization, cart provides a lightweight CRUD interface for item collection before purchase intent is established. This page is checked against the official v2026-08-25 pinned spec and schemas (capability spec · REST binding · Cart schema); the cart capability was introduced in v2026-04-08.
When to use Cart vs Checkout:
- Cart: User is exploring, comparing, saving items for later. No payment configuration needed. Platform/agent can freely add, remove, update items.
- Checkout: User has expressed purchase intent. Payment handlers are configured, status lifecycle begins, session moves toward completion.
The typical flow: cart session → checkout session → order
Carts support:
- Incremental building: Add/remove items across sessions
- Localized estimates: Context-aware pricing without full checkout overhead
- Sharing:
continue_urlenables cart sharing and recovery
Cart vs Checkout
| Aspect | Cart | Checkout |
|---|---|---|
| Purpose | Pre-purchase exploration | Purchase finalization |
| Payment | None | Required (handlers, instruments) |
| Status | Binary (exists/not found) | Lifecycle (incomplete → completed) |
| Complete Operation | No | Yes |
| Handoff URL | continue_url | continue_url |
| Totals | Estimates (may be partial) | Final pricing |
Cart-to-Checkout Conversion
When the cart capability is negotiated, platforms can convert a cart to checkout by providing cart_id in the Create Checkout request. The cart contents (line_items, context, buyer) initialize the checkout session.
{
"cart_id": "cart_abc123",
"line_items": []
}Business MUST use the cart contents and MUST ignore overlapping fields in the checkout payload (the cart_id parameter is only available when the cart capability is advertised in the business profile). If an incomplete checkout already exists for the given cart_id, business MUST return the existing checkout session rather than creating a new one — a single active checkout per cart, preventing conflicting sessions.
Cart lifecycle after conversion:
When checkout is initialized via cart_id, the cart and checkout sessions SHOULD be linked for the duration of the checkout.
During active checkout — Business SHOULD maintain the cart and reflect relevant checkout modifications (quantity changes, item removals) back to the cart. This supports back-to-storefront flows when buyers transition between checkout and storefront.
After checkout completion — Business MAY clear the cart based on TTL, completion of the checkout, or other business logic. Subsequent operations on a cleared cart ID return
not_found; the platform can start a new session withcreate_cart.
Guidelines
Platform
- MAY use carts for pre-purchase exploration and session persistence.
- SHOULD convert cart to checkout when user expresses purchase intent.
- MAY display
continue_urlfor handoff to business UI. - SHOULD handle
not_foundgracefully when cart expires or is canceled.
Business
- SHOULD provide
continue_urlin cart responses for handoff and session recovery. - SHOULD provide estimated totals when calculable.
- MAY omit shipping totals until checkout when address is unknown.
- SHOULD return informational messages for validation warnings.
- MAY set cart expiry via
expires_at. - SHOULD follow cart lifecycle requirements when checkout is initialized via
cart_id.
Operations
The Cart capability defines the following logical operations.
| Operation | Description |
|---|---|
| Create Cart | Creates a new cart session. |
| Get Cart | Retrieves the current state of a cart session. |
| Update Cart | Updates a cart session. |
| Cancel Cart | Cancels a cart session. |
Prerequisites
The business advertises the cart capability (dev.ucp.shopping.cart) with a REST transport endpoint in its profile at /.well-known/ucp; the platform negotiates a shared capability version per Select a version from the profiles before calling the endpoints below. Send UCP-Agent: profile="https://platform.example/profile" and Content-Type: application/json with the create request.
Create Cart
Creates a new cart session with line items and optional buyer/context information. The request body carries cart fields such as line_items at the top level — no ucp wrapper (the capability version comes from session negotiation and is echoed in the response):
Request Body (POST /carts):
{
"line_items": [
{
"item": {
"id": "item_123"
},
"quantity": 2
}
],
"context": {
"address_country": "US",
"address_region": "CA",
"postal_code": "94105"
}
}Response (201 Created):
{
"ucp": {
"version": "2026-08-25",
"capabilities": {
"dev.ucp.shopping.checkout": [{"version": "2026-08-25"}],
"dev.ucp.shopping.cart": [{"version": "2026-08-25"}]
}
},
"id": "cart_abc123",
"line_items": [
{
"id": "li_1",
"item": {
"id": "item_123",
"title": "Red T-Shirt",
"price": 2500
},
"quantity": 2,
"totals": [
{"type": "subtotal", "amount": 5000},
{"type": "total", "amount": 5000}
]
}
],
"currency": "USD",
"totals": [
{"type": "subtotal", "amount": 5000},
{"type": "total", "amount": 5000, "display_text": "Estimated total (taxes calculated at checkout)"}
],
"continue_url": "https://business.example.com/checkout?cart=cart_abc123",
"expires_at": "2026-08-26T12:00:00Z"
}The cart id sits at the top level of the response; the ucp block carries only the version and capability advertisement. If all items are out of stock, the REST binding returns 200 OK with ucp.status = "error" and an out_of_stock message of severity unrecoverable.
Get Cart
Retrieves the latest state of a cart session. If the cart is missing, expired, or canceled, the REST binding returns 200 OK with ucp.status = "error" and messages[].code set to not_found. Start a new cart when the buyer wants to continue.
Response: Same as Create Cart response.
Update Cart
Performs a full replacement of the cart session. The platform MUST send the entire cart resource. The provided resource replaces the existing cart state on the business side.
Request Body: Same as Create Cart request.
Cancel Cart
Cancels a cart session. Business MUST return the cart state before deletion. Subsequent operations for this cart ID return not_found.
Response: Same as Get Cart response (final state before deletion).
Entities
Cart reuses the same entity schemas as Checkout. This ensures consistent data structures when converting a cart to a checkout session.
Line Item
Line Item Create Request
{
"item": {
"id": "product_123",
"title": "Running Shoes"
},
"quantity": 1
}Line Item Update Request
{
"item": {
"id": "product_123"
},
"quantity": 2
}Line Item Response
{
"id": "li_1",
"item": {
"id": "item_123",
"title": "Red T-Shirt",
"price": 2500
},
"quantity": 2,
"totals": [
{"type": "subtotal", "amount": 5000},
{"type": "total", "amount": 5000}
]
}Buyer
{
"email": "[email protected]",
"phone": "+1234567890"
}Context
{
"address_country": "US",
"address_region": "CA",
"postal_code": "94105"
}Total
{
"type": "total",
"amount": 5000,
"display_text": "Estimated total (taxes calculated at checkout)"
}The totals array MUST contain exactly one subtotal and one total entry; detail types (tax, fee, discount, fulfillment) may appear multiple times for itemization. Platforms render display_text and amount entries in order; amounts are integers in the currency’s smallest unit, with the currency given by the cart-level currency field. Cart totals are estimates — accurate taxes are computed at checkout.
Message
Message Error
{
"type": "error",
"code": "invalid_quantity",
"content": "Quantity must be greater than 0"
}Message Info
{
"type": "info",
"code": "price_updated",
"content": "Item price has been updated"
}Message Warning
{
"type": "warning",
"code": "low_stock",
"content": "Only 3 items remaining"
}Link
{
"rel": "checkout",
"href": "https://business.example.com/checkout?cart=cart_abc123"
}Transport Bindings
The abstract operations above are bound to specific transport protocols as defined below:
- REST Binding: RESTful API mapping for HTTP-based integration
- MCP Binding: Model Context Protocol mapping via JSONRPC for AI agent integration
Official Specification
- Official Cart Capability: https://ucp.dev/2026-08-25/specification/cart/
- GitHub Repository: https://github.com/Universal-Commerce-Protocol/ucp