For the complete documentation index, see llms.txt. This page is also available as Markdown.

One-time purchases

A one-time purchase in tiun ties an identified user to a product through a single payment. This page covers the lifecycle from anonymous visitor to paying customer — and why, unlike a subscription, there is nothing after that to manage.


The journey

  1. A visitor arrives unauthenticated — no tiun session yet.

  2. They open checkout directly. The overlay collects email and payment; completing it authenticates the user and grants access to the product in one step.

  3. Alternatively they may log in first with tiun.login(), then buy later via checkout when ready.

  4. A returning user on the same browser gets session restoration automatically; userChange fires with event: 'init' so your UI can sync.

  5. The user may log out; the session is cleared and they're anonymous again until they sign in again. Logging back in restores the purchase.

Checkout authenticates the user automatically. If a visitor goes directly to checkout without logging in first, they provide their email during the payment flow and are authenticated as part of completing it.


Access is permanent

A one-time purchase is charged once. There is no billing cycle, no renewal, no cancellation flow, and no expiration.

Once checkout completes, the product ID is added to the user's productAccess and stays there — across sessions, logouts, and new devices, for as long as the account exists. Your gating code never has to handle revocation for a one-time product: if the ID is in the array, the customer has paid for it.

See Product access for how that array is populated and how to check it in code.

Because access can't be cancelled, you can't reset a one-time purchase for a test customer. To re-test a first-purchase flow in sandbox, run checkout with a new email address — see simulating payments.


Bought once per customer

The same customer can't buy the same one-time product twice. tiun stops the repeat purchase before any money moves, in both directions it can be attempted:

  • Signed in and already entitled — checkout links the existing entitlement instead of charging again, and the customer sees an "already purchased, no new charge was made" screen.

  • Signed out, signing up again with the same email — the sign-up is rejected because the customer already exists. They have to log in to reach what they own.

So a one-time product is a perpetual licence, not a consumable. It isn't a shop item that can be re-ordered: there are no quantities, carts, credit packs, or "buy another" flows. If you need customers to buy the same thing repeatedly, a one-time product is not the right model for it.

Two consequences for your UI:

  1. Hide or disable the buy button once the customer owns the product. Gate it on productAccess.includes(productId). Leaving it live sends a paying customer into a checkout that cannot charge them.

  2. Put a visible Log in option on your sales page, not just a buy button. Login is the only route back for a returning customer — signing up again with their email is rejected, so a buy-only page leaves them stuck.

Copy should match the model too: "Buy", "Purchased", "You own this" — not "Subscribe", "Manage your plan", "Renews on", or "Cancel". None of those states exist for a one-time purchase.


Where to go next

Last updated

Was this helpful?