App commerce sells one-time products backed by Space-level billing. The SDK surface is client.app.commerce.*; older Work-era work.commerce spellings may remain as aliases.
Runtime
Commerce runs only inside a published App shell: context(), authorization, purchase, and entitlement calls do not work on raw static URLs or local previews.
Core objects
- Product - what is sold (
productKey; price and Cohub Balance amount are immutable after creation) - Benefit - a
featuregate orcreditsgrant - Order / checkout - host-owned redirect loop
- Credits - virtual
cohub_creditbalance; consume with an idempotentoperationId - Purchase attempt - stable
purchaseAttemptIdreused across timeout retries - Cohub Balance - optional global USD balance component on a product
Reliable purchase loop
Feature: load -> entitlement -> purchase -> return -> reload.
Credits: load -> balance -> consume -> purchase when empty -> return -> reload.
Purchase calls carry a stable purchaseAttemptId (or idempotency key) so a timeout retry resolves to the original Billing order instead of creating a duplicate.