# 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 or a time-based rate), then call **checkout** (subscriptions) 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, PayPal, Apple Pay, Google Pay, PrePaid (tiun credits), and Twint.                      |
| **Authentication**      | Email + OTP login, no passwords.                                                              |
| **Session persistence** | Returning users are recognized automatically — sessions and payment connections are restored. |
| **Access control**      | Subscription state and paywall events, handled for you.                                       |
| **Customer data**       | Users, subscriptions, 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: 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:

```
GET https://docs.tiun.io/how-it-works.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
