Ucp discount

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

Ucp discount is an AI agent skill from the GitHub repository OrcaQubits/agentic-commerce-skills-plugins. Implement the UCP Discount extension — discount code application, validation, allocation tracking, and error handling. Use when adding promo code or discount logic to a UCP checkout.

How to use this skill

Skill file

UCP Discount Extension

Before writing code

Fetch live spec: Web-search site:ucp.dev specification discount and fetch the page for the exact discount schema, allocation model, and error codes.

Conceptual Architecture

Extension Relationship

Discount extends dev.ucp.shopping.checkout. Pruned if Checkout capability is absent.

Key Concepts

Allocation Invariant

Sum of allocations[].amount MUST equal applied_discount.amount. This ensures the discount is fully accounted for.

Each allocation has:

Error Codes

UCP defines standard discount error codes:

These appear in the messages array with type: "warning" specifically when a discount code is rejected.

Flow

  1. Platform sends discount codes in the checkout update
  2. Business validates codes, applies valid ones, returns errors for invalid ones
  3. Applied discounts affect line item totals and session totals
  4. Agent resolves discount errors (remove invalid code, inform user of ineligibility, etc.)

Implementation Guidance

Fetch the exact schema from the live spec before implementing. Pay attention to how discounts interact with fulfillment costs and tax calculations — the spec defines the ordering.

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.