Skip to main content
To sell a product, generate a checkout URL and redirect the customer to it. Hexclave runs the hosted checkout, receives the payment confirmation, and grants the product - you never write a webhook handler.

Selling a product

The createCheckoutUrl method is available on both user and team objects.
app/components/purchase-button.tsx
For team purchases, call 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.
On the server, you can also pass an inline product definition instead of 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 **0recurringpriceactivateswithoutcollectingacard.Onetime0 recurring** price activates without collecting a card. One-time 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
The URL still expires in 24 hours. Send it to the customer, or open it yourself while testing.

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.
Each product in the list includes:
  • id - The product ID (or null for inline products)
  • displayName - The product name
  • quantity - How many the customer owns (relevant for stackable products)
  • subscription - null for one-time products, or an object with subscriptionId, currentPeriodEnd, cancelAtPeriodEnd, and isCancelable for subscriptions
  • switchOptions - Other products in the same product line the customer could switch to