> For the complete documentation index, see [llms.txt](https://docs.tiun.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tiun.io/reference/checkout/one-time-purchases.md).

# 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.

{% hint style="info" %}
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.
{% endhint %}

***

## 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](/reference/checkout/product-access.md) for how that array is populated and how to check it in code.

{% hint style="info" %}
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](/guides/testing/simulate-payments.md).
{% endhint %}

***

## 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

* [Checkout / How it works](/reference/checkout/how-it-works.md) — what the overlay does and how identity is verified.
* [Product access](/reference/checkout/product-access.md) — how `productAccess` is populated and how to gate features.
* [Products](/reference/generic/products.md) — how the one-time product type compares to subscriptions and time-based billing.
* [Authentication / How it works](/reference/authentication/how-it-works.md) — the broader login and session model.
* For an end-to-end walkthrough, see [selling one-time products](/guides/one-time-purchases/sell-one-time-products.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.tiun.io/reference/checkout/one-time-purchases.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
