> 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/how-it-works.md).

# How it works

## The core flow

tiun replaces the commercial backend you'd normally build yourself. Instead of stitching together a payment provider, an auth system, session management, and access control — you create a product in the tiun dashboard, and the SDK handles everything from checkout to access.

The flow is simple: you define a **product** (a subscription plan, a one-time fixed fee, or a time-based rate), then call **checkout** (subscriptions and one-time purchases) or **start** (time-based) from your frontend. tiun takes over — it shows the payment UI, authenticates the user, processes the payment, and manages the session. Your app receives an event when **access** is granted, and you show the content.

There's no backend to build. No webhook endpoints to maintain. No user tables to manage. tiun is the layer between your frontend and all the commercial infrastructure — payments, identity, access control, customer data. You write product logic; tiun handles the commercial stack.

***

## What tiun manages for you

| Feature                 | What you get                                                                                  |
| ----------------------- | --------------------------------------------------------------------------------------------- |
| **Checkout UI**         | Fully hosted payment overlay, no forms to build.                                              |
| **Payment processing**  | Cards (Visa, Mastercard, Amex), Apple Pay, Google Pay, PayPal and TWINT (region-dependent).   |
| **Authentication**      | Email + OTP login, no passwords.                                                              |
| **Session persistence** | Returning users are recognized automatically — sessions and payment connections are restored. |
| **Access control**      | Entitlement state and paywall events, handled for you.                                        |
| **Customer data**       | Users, purchases, and revenue tracked in your dashboard.                                      |

***

<h2 align="center">Next steps</h2>

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Quickstart</strong></td><td>Install the SDK and connect your app to tiun.</td><td><a href="/pages/NzxwLP2NcGpmQpc2wiCX">/pages/NzxwLP2NcGpmQpc2wiCX</a></td></tr><tr><td><strong>Guides</strong></td><td>Step by step instructions for different use-cases</td><td><a href="/spaces/v0tFzjHQUACOiUonWO2S">/spaces/v0tFzjHQUACOiUonWO2S</a></td></tr><tr><td><strong>Reference</strong></td><td>Core concepts and detailed explanations</td><td><a href="/spaces/T5ZmfCMnTzOFQHEyzxIC">/spaces/T5ZmfCMnTzOFQHEyzxIC</a></td></tr></tbody></table>


---

# 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/how-it-works.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.
