> 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/guides/testing/debugging.md).

# Debugging

When something does not behave as expected, start with SDK logging and a short checklist of common causes before escalating.

## Debug mode

Pass **`debug: true`** in the `tiun.init` configuration to turn on **console logging** from the SDK. That helps you see initialization, event flow, and errors during development.

```javascript
tiun.init({
  snippetId: 'YOUR_SNIPPET_ID',
  language: 'en', // 'en' | 'de' | 'fr'
  debug: true,
});
```

Disable or omit `debug` in your live builds if you prefer minimal client noise.

## Common issues

| Issue                        | Likely cause                                | What to try                                                                                                                                                  |
| ---------------------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Events not firing            | SDK not initialized                         | Call `tiun.init()` before subscribing to events.                                                                                                             |
| Checkout not opening         | Wrong or stale product ID                   | Live and sandbox have separate catalogs — compare the ID to the dashboard view for the same environment your SDK uses (`sandbox: true` → sandbox toggle on). |
| Connect overlay not opening  | SDK not initialized or wrong environment    | Ensure `tiun.init()` has been called and the snippet is configured for a time-based product.                                                                 |
| Sandbox payments not working | App and dashboard on different environments | Use sandbox snippet ID and `p-test-...` IDs with `sandbox: true`; confirm the dashboard **Sandbox** toggle is on while configuring test data.                |
| User state not updating      | Relying only on snapshot properties         | Listen for **`userChange`** and update UI from the event payload.                                                                                            |
| Session not restoring        | Different browser or cleared storage        | Sessions are per browser; clearing cookies or site data clears the session.                                                                                  |

## Event reference

For a full list of events and payloads, see [SDK events](/sdk/reference/events.md).

## Support

If logs and the table above do not resolve the issue, contact <support@tiun.app> with steps to reproduce and, when possible, snippet ID and environment (sandbox or live).


---

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

```
GET https://docs.tiun.io/guides/testing/debugging.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.
