Subscriptions
A subscription in tiun ties an identified user to a product on a recurring schedule. This page covers the lifecycle from anonymous visitor to paying customer to expiration — and what your app should expect at each step.
The journey
A visitor arrives unauthenticated — no tiun session yet.
They open checkout directly. The overlay collects email and payment; completing it authenticates the user and grants access to the product in one step.
Alternatively they may log in first with
tiun.login(), then subscribe later via checkout when ready.A returning user on the same browser gets session restoration automatically;
userChangefires withevent: 'init'so your UI can sync.The user may log out; the session is cleared and they're anonymous again until they sign in or check out again.
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.
Flow diagram

The top branch shows login first, then optional checkout or logout. The bottom branch shows checkout from cold start, which both subscribes and establishes identity.
Renewal and expiration
Subscription renewal is automatic. tiun handles the billing cycle, payment retries, and keeps subscription state consistent with what the customer has paid for — you don't run cron jobs or webhook listeners for renewals.
While a subscription is active, the corresponding product ID appears in the user's productAccess. When access ends — after a successful cancellation or a permanent payment failure — tiun removes the product ID and emits userChange so your UI immediately reflects the new state. See Product access for how that array is the source of truth and how to check it in code.
You do not need to implement any manual renewal management for the standard subscription lifecycle.
Where to go next
Checkout / How it works — what the overlay does and how identity is verified.
Product access — how
productAccessis populated and how to gate features.Authentication / How it works — the broader login and session model.
For an end-to-end walkthrough, see monetizing with subscriptions.
Last updated
Was this helpful?