← All Articles

UCP Totals Now Accept Signed Amounts

Bug Fix March 24, 2026 · PR #299
RC

Ryan C (wry-ry)

UCP contributor focused on schema correctness and checkout flow semantics. Previously contributed to CI pipeline overhauls and documentation improvements.

Why This Matters

UCP's checkout specification has always supported negative amounts — discounts, account credits, and promotional adjustments that reduce the total. The official examples show this clearly. But until now, there was a subtle schema bug: the total field referenced amount.json (unsigned) instead of signed_amount.json.

This mismatch meant that while the spec described negative totals, the schema would reject them. Implementers following the JSON Schema strictly would find their discount scenarios failing validation.

The Problem

When a checkout total goes negative (e.g., a $50 order with a $60 account credit), the total is -$10.00. The old schema couldn't represent this — the amount type only accepted non-negative values.

What Changed Technically

The fix is elegant in its simplicity: a single-line change swapping the schema reference from amount.json to signed_amount.json.

// Before
"total": { "$ref": "amount.json" }

// After
"total": { "$ref": "signed_amount.json" }
Files Changed
1
Lines Added
1
Lines Removed
1

Commerce Scenarios Unlocked

This seemingly small change unlocks important commerce patterns that were technically unsupported:

Implications for Implementers

If you're implementing a UCP merchant or agent:

  1. Update your schema: Pull the latest UCP schemas to enable signed total validation.
  2. Review total handling: Ensure your payment processing can handle negative totals gracefully — these typically indicate credits rather than charges.
  3. Test edge cases: Validate that your checkout flows handle the zero-crossing correctly (positive → negative → positive).

🔮 What's Next

This PR is currently open and under review. The fix aligns the schema with the specification's documented examples, so approval is expected. Watch for the merge and subsequent spec version bump.

Related work: PR #295 adds attribution extensions to checkout, and PR #296 introduces card network token credentials — both building out UCP's payment infrastructure.