Selling a product
ThecreateCheckoutUrl method is available on both user and team objects.
- Client Component
- Server Component
app/components/purchase-button.tsx
createCheckoutUrl on the team object instead:
If you’re using a non-JS backend (Python, Go, etc.), call the REST API directly:
POST /api/v1/payments/purchases/create-purchase-url with customer_type, customer_id, and product_id. See the REST API overview for details.productId, or create a URL for a custom customer:
Hosted checkout
createCheckoutUrl returns a hosted Hexclave page (/purchase/{code}). Price and quantity are chosen on that page, not in the URL. Stackable products show a quantity selector.
Checkout URLs expire after 24 hours. If Block new purchases is on in Payments -> Settings, creating a URL and completing checkout both fail; existing subscriptions keep renewing.
A **0 prices cannot go through checkout.
Free trials collect a card up front and charge it when the trial ends. In test mode, checkout grants the product immediately and skips the trial.
Creating a checkout URL from the dashboard
You don’t have to generate URLs in code. Create checkout is available from:- Payments -> Customers (user, team, or custom)
- A product’s detail page, and product cards in Payments -> Product Lines
- The Users and Teams tables
Checking what a customer owns
After a purchase, you’ll want to know what the customer has. Check their product list, or check a specific item balance.id- The product ID (ornullfor inline products)displayName- The product namequantity- How many the customer owns (relevant for stackable products)subscription-nullfor one-time products, or an object withsubscriptionId,currentPeriodEnd,cancelAtPeriodEnd, andisCancelablefor subscriptionsswitchOptions- Other products in the same product line the customer could switch to
Related
- Items & Entitlements - read and consume credits, seats, and quota
- Subscriptions - manage recurring plans after purchase
- Refunds - reverse a purchase from the dashboard
- Granting Products - give access without checkout