> 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** — checkout signs the customer in with their email. Once it recognizes them as the owner, it shows the same "already purchased" screen instead of payment details, and nothing is charged.

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. **Give returning customers a sign-in entry point**, not just a buy button. Checkout won't charge them twice, but a returning customer who wants their content shouldn't have to go through a purchase flow to get it.

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 pricing model 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
