Initialization

Creating the client

Import the SDK and call init() once at app startup. The SDK automatically loads the tiun snippet from the backend — no script tags or extra HTML required.

import { tiun } from '@tiun/sdk';

tiun.init({
  snippetId: 'YOUR_SNIPPET_ID',
  language: 'en', // set to your site's language
});
circle-info

Set language to match your site. If omitted, the snippet UI defaults to 'en'. See the full list of supported codes in the config table below.

Configuration options

Option
Type
Default
Description

snippetId

string

Required. Your snippet ID from the dashboard.

language

string

'en'

Language for the snippet UI (e.g. 'en', 'de', 'fr'). Set this to match your site; falls back to 'en' if omitted.

tone

'formal' | 'informal'

'formal'

Tone of the snippet copy.

debug

boolean

false

Enable debug logging to the console.

sandbox

boolean

false

Use the sandbox environment for testing.

You can also pass event callbacks directly in the config. See Events for the full list.

tiun.init({
  snippetId: 'YOUR_SNIPPET_ID',
  language: 'en',
  onReady: () => console.log('ready')
});

Environment setup

Set sandbox: true during development to use the sandbox environment. This lets you test your integration with simulated payments without processing real charges.

Full example

Last updated

Was this helpful?