> 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/sdk/react-native-sdk/configuration.md).

# Configuration

## Mount the provider

Wrap your app in `<TiunProvider>` once. It holds the tiun session and renders the login and checkout overlays, so it must sit **above every component that uses the tiun hooks** — that's the only placement rule. The overlay sizes itself to the window, so it covers your UI correctly wherever in the tree the provider is mounted; the app root is simply the most convenient place for it.

```tsx
import { TiunProvider } from '@tiun/react-native-sdk';

export default function App() {
  return (
    <TiunProvider
      config={{
        snippetId: 'YOUR_SNIPPET_ID',
        returnUrl: 'myapp://tiun/return',
      }}
    >
      <RootNavigator />
    </TiunProvider>
  );
}
```

The provider is invisible until the user opens login or checkout; the rest of the time it takes up no space on screen.

***

## Configuration options

| Option       | Type                          | Default                 | Description                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ------------ | ----------------------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `snippetId`  | `string`                      | —                       | **Required.** Your snippet ID from the dashboard.                                                                                                                                                                                                                                                                                                                                                                                  |
| `returnUrl`  | `string`                      | —                       | **Required.** The deep link the in-app browser returns to after payment, for example `myapp://tiun/return`. Its scheme must be registered natively — see [Installation](/sdk/react-native-sdk/installation.md#register-the-return-deep-link) — and must match the **App scheme** in the dashboard's **Settings → Environment setup** for the environment you target. If it doesn't, login and checkout close as soon as they open. |
| `host`       | `string`                      | `https://api.tiun.live` | Origin of the tiun environment to use, without a trailing slash. Set this to target sandbox.                                                                                                                                                                                                                                                                                                                                       |
| `language`   | `string`                      | `'en'`                  | Language for the overlay UI: `'en'`, `'de'`, or `'fr'`.                                                                                                                                                                                                                                                                                                                                                                            |
| `appearance` | `'light' \| 'dark' \| 'auto'` | `'light'`               | Color theme for the snippet. `'auto'` follows the OS setting. Changing it re-themes the open snippet live.                                                                                                                                                                                                                                                                                                                         |
| `debug`      | `boolean`                     | `false`                 | Log the native bridge traffic to the console, prefixed `[tiun]`.                                                                                                                                                                                                                                                                                                                                                                   |

Keep the config object stable — define it as a module-level constant rather than building it inline on every render:

```tsx
import type { TiunConfig } from '@tiun/react-native-sdk';

export const TIUN_CONFIG: TiunConfig = {
  snippetId: 'YOUR_SNIPPET_ID',
  returnUrl: 'myapp://tiun/return',
  language: 'en',
  appearance: 'light',
};
```

***

## Sandbox and live

tiun runs **live** and **sandbox** as two independent parallel environments, each with its own snippet ID, products, and product IDs. In React Native you select the environment with `host`:

| Environment | `host`                                            | Snippet and product IDs                 |
| ----------- | ------------------------------------------------- | --------------------------------------- |
| Live        | `https://api.tiun.live` *(default — omit `host`)* | Live snippet ID, `p-live-…` products    |
| Sandbox     | `https://api-sandbox.tiun.live`                   | Sandbox snippet ID, `p-test-…` products |

```tsx
// Development build — sandbox
export const TIUN_CONFIG: TiunConfig = {
  snippetId: 'YOUR_SANDBOX_SNIPPET_ID',
  host: 'https://api-sandbox.tiun.live',
  returnUrl: 'myapp://tiun/return',
  debug: true,
};
```

{% hint style="info" %}
**The React Native SDK has no `sandbox` flag.** Where the web SDK takes `sandbox: true`, the React Native SDK takes the environment's origin in `host`. Switch the snippet ID and the product IDs together with it — IDs never cross between environments.
{% endhint %}

For how the two environments relate, see [Sandbox](/reference/generic/sandbox.md) in Reference, and [setting up your environment](/guides/getting-started/set-up-environment.md) for the dashboard side.

***

Next: read the state and call tiun from your components with [Hooks and events](/sdk/react-native-sdk/hooks.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/sdk/react-native-sdk/configuration.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.
