Vue
Examples of common tiun SDK patterns in Vue 3. Each section is standalone — use what applies to your integration.
For Nuxt (SSR), see the Nuxt example.
Initialize
Initialize the SDK in onMounted of your root component (typically App.vue).
<script setup>
import { tiun } from '@tiun/sdk';
import { onMounted } from 'vue';
onMounted(() => {
tiun.init({
snippetId: 'YOUR_SNIPPET_ID',
language: 'en', // 'en' | 'de' | 'fr'
});
});
</script>
<template>
<!-- your app -->
</template>Checkout
Trigger checkout on a button click. Pass the product ID from your dashboard.
Listen for user changes
Track authentication and access state with userChange. Store it in reactive refs so your components update automatically.
Gate content
Show or hide content based on productAccess.
Login and logout
Add authentication buttons to your navigation.
Paywall events (time-based)
For time-based billing, use paywallShow and paywallHide to control access.
Content management (time-based)
Call setContent() on route changes to keep billing accurate.
Last updated
Was this helpful?

