ucp-checkout-rest

Implement UCP Checkout over the REST binding — create, get, update, complete, and cancel checkout sessions with proper headers, idempotency, status transitions, and error handling. Use when building REST-based UCP checkout endpoints or clients.

17 stars

Best use case

ucp-checkout-rest is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Implement UCP Checkout over the REST binding — create, get, update, complete, and cancel checkout sessions with proper headers, idempotency, status transitions, and error handling. Use when building REST-based UCP checkout endpoints or clients.

Teams using ucp-checkout-rest should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/ucp-checkout-rest/SKILL.md --create-dirs "https://raw.githubusercontent.com/OrcaQubits/agentic-commerce-skills-plugins/main/dist/antigravity/ucp-agentic-commerce/.agent/skills/ucp-checkout-rest/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/ucp-checkout-rest/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How ucp-checkout-rest Compares

Feature / Agentucp-checkout-restStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Implement UCP Checkout over the REST binding — create, get, update, complete, and cancel checkout sessions with proper headers, idempotency, status transitions, and error handling. Use when building REST-based UCP checkout endpoints or clients.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# UCP Checkout — REST Binding

## Before writing code

**Fetch live spec**: Web-search `site:ucp.dev specification checkout-rest` and fetch the page for the exact current endpoint shapes, required headers, request/response schemas, and status codes.

Also fetch https://ucp.dev/specification/reference/ for all data type definitions (Buyer, LineItem, Total, Message, etc.).

## Conceptual Architecture

### Five REST Operations

| Operation | HTTP | Path | Idempotent? |
|-----------|------|------|-------------|
| Create Checkout | POST | `/checkout-sessions` | Yes (via Idempotency-Key) |
| Get Checkout | GET | `/checkout-sessions/{id}` | Naturally |
| Update Checkout | PUT | `/checkout-sessions/{id}` | Yes (full replace) |
| Complete Checkout | POST | `/checkout-sessions/{id}/complete` | Yes (via Idempotency-Key) |
| Cancel Checkout | POST | `/checkout-sessions/{id}/cancel` | Yes (via Idempotency-Key) |

### Required Headers (every request)

- `UCP-Agent`: Platform's profile URI in RFC 8941 structured field format — `profile="https://..."`
- `Idempotency-Key`: UUID for mutating operations; Business caches 24+ hours
- `Request-Id`: UUID for distributed tracing
- `Request-Signature`: Cryptographic signature for request integrity verification
- `Content-Type`: `application/json`

### Status State Machine

```
incomplete → requires_escalation → ready_for_complete → complete_in_progress → completed
     |               |                    |                      |
     +---------------+--------------------+----------------------+--------→ canceled
```

The `canceled` state is reachable from any non-terminal state (incomplete, requires_escalation, ready_for_complete, complete_in_progress).

The agent's job is to drive the session from `incomplete` to `ready_for_complete` by resolving messages, then call complete.

### Negotiation in Every Response

Every response includes a `ucp` object with the negotiated version and capabilities. The Business computes the intersection of its own capabilities with the Platform's profile, prunes orphaned extensions, and returns only what both sides support.

### Error Handling Pattern

Responses include a `messages` array. Each message has:
- `type`: error / warning / info
- `code`: Machine-readable error code
- `content`: Human-readable description
- `severity`: recoverable / requires_buyer_input / requires_buyer_review (these are the 3 formal enum values; note: `escalation` appears in some spec sections but is NOT part of the formal severity enum — this is a spec inconsistency)
- `path`: JSONPath pointing to the problematic field

**Agent behavior by severity:**
- `recoverable` → Agent fixes automatically (e.g., update with missing address)
- `requires_buyer_input` → Ask the human user
- `requires_buyer_review` → Show totals/terms for human confirmation
- `escalation` → Redirect to `continue_url`

### Implementation Checklist

**Business (merchant server):**
1. Parse `UCP-Agent` header and fetch platform profile for negotiation
2. Validate `Idempotency-Key` — return cached response if duplicate
3. Create checkout session with line items, compute totals
4. Return negotiated `ucp` object + full session state + messages
5. Handle Update by recalculating totals, re-validating, updating messages
6. Handle Complete by processing payment credential, creating order
7. Handle Cancel by cleaning up session
8. Return proper HTTP status codes (201 Created, 200 OK, 400/409/429, etc.)

**Platform (agent client):**
1. Discover Business profile at `/.well-known/ucp`
2. Send `UCP-Agent` header with own profile URI
3. Create checkout, inspect `status` and `messages`
4. Loop: resolve messages → update checkout → re-check status
5. When `ready_for_complete`: acquire payment credential, call complete
6. Handle `requires_escalation` by surfacing `continue_url` to user

### Monetary Values

All amounts are **integers in minor currency units** (e.g., $29.99 = `2999`). Never use floating point.

### TLS Requirement

All UCP REST endpoints MUST be served over HTTPS with minimum TLS 1.3.

Related Skills

woo-checkout

17
from OrcaQubits/agentic-commerce-skills-plugins

Customize WooCommerce checkout — classic and block-based checkout, custom fields, validation, order processing, and checkout extensibility. Use when modifying the checkout flow, adding custom checkout fields, or integrating checkout extensions.

ucp-embedded-checkout

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement UCP Embedded Checkout Protocol — iframe/webview-based checkout UI for human escalation using JSON-RPC 2.0 over postMessage. Use when the checkout status is requires_escalation and the buyer needs a merchant-hosted UI.

ucp-checkout-mcp

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement UCP Checkout over the MCP (Model Context Protocol) binding — expose checkout operations as MCP tools for AI agents. Use when building an MCP server that AI agents like Claude or Gemini can call for commerce, or when integrating with Shopify's MCP endpoint.

ucp-checkout-a2a

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement UCP Checkout over the A2A (Agent-to-Agent) binding — enable autonomous agent-to-agent commerce using Agent Cards and structured message parts. Use when building agent-to-agent commerce flows.

spree-checkout

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement Spree's checkout — the Order state machine (cart → address → delivery → payment → confirm → complete), the Payment and Shipment sub-state machines, the return flow (ReturnAuthorization → CustomerReturn → Reimbursement → Refund), guest checkout, payment-step skipping for credit-covered orders, and the V3 checkout API surface. Use when building or customizing checkout flows, debugging state transitions, or wiring custom checkout steps.

shopify-checkout-ui

17
from OrcaQubits/agentic-commerce-skills-plugins

Build Shopify checkout UI extensions — extension targets, UI primitives, Preact/Remote DOM rendering, checkout APIs, metafield access, post-purchase extensions, and thank-you page customization. Use when customizing Shopify checkout.

shopify-api-rest

17
from OrcaQubits/agentic-commerce-skills-plugins

"MIGRATION SKILL: Shopify REST Admin API — endpoint patterns, authentication, rate limits, and REST-to-GraphQL migration guide. The REST Admin API is deprecated (October 2024). Use this skill only for maintaining legacy integrations or planning migration to GraphQL."

saleor-checkout

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement the Saleor checkout flow — checkout creation, line items, shipping/billing addresses, delivery methods, payment, and completion. Use when building checkout experiences.

medusa-cart-checkout

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement Medusa v2 cart and checkout — cart lifecycle, line items, shipping and payment selection, sales channels, and checkout completion flow. Use when building cart and checkout features.

magento-checkout

17
from OrcaQubits/agentic-commerce-skills-plugins

Customize Magento 2 checkout — payment methods, shipping carriers, totals collectors, and checkout UI. Use when building custom payment/shipping integrations or modifying the checkout flow.

bc-checkout

17
from OrcaQubits/agentic-commerce-skills-plugins

Customize BigCommerce checkout — Checkout SDK, embedded checkout, server-side checkout API, custom checkout UI, and checkout extensions. Use when modifying the checkout experience or building headless checkout flows.

bc-api-rest

17
from OrcaQubits/agentic-commerce-skills-plugins

Use BigCommerce REST APIs — V2 and V3 endpoints, authentication, rate limiting, pagination, filtering, batch operations, and error handling. Use when integrating with BigCommerce data via REST API.