ACP Discount Extension
Before writing code
Fetch live docs:
- Web-search
site:github.com agentic-commerce-protocol rfcs discount_extensionfor the discount extension RFC - Web-search
site:github.com agentic-commerce-protocol examples discount-extensionfor discount examples - Fetch
https://developers.openai.com/commerce/specs/checkout/for how discounts interact with checkout - Web-search
site:github.com agentic-commerce-protocol spec json-schema discountfor the discount JSON schema
Conceptual Architecture
What the Discount Extension Does
The discount extension adds coupon/promo code support to ACP checkout sessions. It's a built-in extension that follows the extensions framework with independent versioning.
Extension Identity
- Name:
discount - Version: Calendar versioned (e.g.,
discount@2026-01-27) - JSONPath target:
$.CheckoutSessionCreateRequest.discountsand related locations
Three Components
- Submitted Codes — Agent sends
discounts.codes[]with discount codes the buyer wants to apply - Applied Discounts — Merchant responds with successfully applied discounts, including coupon details and monetary allocations to line items
- Rejected Codes — Merchant responds with codes that couldn't be applied, including error reasons
Discount Error Codes
When a code is rejected, the merchant returns a reason:
discount_code_expired— Code has expireddiscount_code_invalid— Code doesn't existdiscount_code_combination_disallowed— Can't combine with other active discountsdiscount_code_minimum_not_met— Cart total below minimum thresholddiscount_code_usage_limit_reached— Code has been used too many timesdiscount_code_already_applied— Code is already active on this sessiondiscount_code_user_not_logged_in— Discount requires an authenticated userdiscount_code_user_ineligible— User does not qualify for this discount
Discount Allocations
When a discount is applied, the merchant shows how the discount is distributed:
- Allocations map discount amounts to specific line items using a JSONPath
pathfield (e.g.,$.line_items[0]) - Each allocation specifies the JSONPath
pathto the target line item and the discount amount - This allows the agent to explain exactly how the discount was applied
Interaction with Totals
Applied discounts affect the totals[] array:
items_discount— Total discount on itemsdiscount— Order-level discounts- These reduce the
totalaccordingly
Extension Negotiation
The discount extension follows capability negotiation:
- Agent includes
discountincapabilities.extensions[] - Merchant confirms support in the response
- If not negotiated, discount fields are ignored
Best Practices
- Validate codes against your promotion system before applying
- Return clear error codes with human-readable messages
- Support multiple concurrent discount codes if your business allows
- Include allocations so the agent can explain the discount to the buyer
- Handle edge cases: expired during session, minimum not met after item removal
- Test code combination rules thoroughly
Fetch the discount extension RFC and JSON schema for exact field names, error code enumeration, and allocation structure before implementing.