Start
Getting started
Connect your app to stubkit in five minutes. This guide assumes you already have a stubkit account and at least one registered tenant (sign in at app.stubkit.com and run the onboarding wizard if you do not).
1. Install the SDK
Pick your platform:
# JavaScript / TypeScript / React Native
pnpm add @stubkit/js
# or: npm install @stubkit/js
# Swift (iOS / macOS) — add via SPM:
# https://github.com/stubkithq/stubkit-swift
# Kotlin (Android) — add JitPack repo + dependency:
# repositories { maven { url = uri("https://jitpack.io") } }
# implementation("com.github.stubkithq:stubkit-kotlin:1.0.2")
# Flutter / Dart — install via git reference:
# dependencies:
# stubkit:
# git:
# url: https://github.com/stubkithq/stubkit-flutter
# ref: v1.0.12. Configure & check entitlement
JavaScript / TypeScript
import { StubkitClient } from '@stubkit/js';
const stubkit = new StubkitClient({
appId: 'your-app',
getAuthToken: async () => await getAccessToken(),
});
const isPro = await stubkit.isActive(userId, 'pro');Swift (iOS)
import stubkit
// AppDelegate or @main App init
stubkit.configure(apiKey: "pk_live_xxx", appId: "your-app")
// Anywhere
let isPro = try await stubkit.shared.isActive(userId: "u123", entitlement: "pro")Kotlin (Android)
import com.stubkit.stubkit
// Application.onCreate
stubkit.configure(apiKey = "pk_live_xxx", appId = "your-app")
// Anywhere (coroutine scope)
val isPro = stubkit.shared.isActive("u123", "pro")Flutter / Dart
import 'package:stubkit/stubkit.dart';
stubkit.configure(apiKey: 'pk_live_xxx', appId: 'your-app');
final isPro = await stubkit.shared.isActive('u123', 'pro');3. Sync a purchase
After your in-app purchase listener fires, hand the receipt to stubkit:
// JavaScript
const entitlements = await stubkit.syncPurchase({
userId: currentUserId,
platform: 'ios',
productId: 'com.example.pro.monthly',
receipt: appleReceiptBase64,
transactionId: appleTransactionId,
});
// Swift — after StoreKit 2 transaction
let entitlements = try await stubkit.shared.syncPurchase(
userId: "u123",
platform: .ios,
productId: transaction.productID,
receipt: transaction.jwsRepresentation
)
// Kotlin — after BillingClient purchase
val entitlements = stubkit.shared.syncPurchase(
userId = "u123",
platform = Platform.ANDROID,
productId = "com.example.pro",
receipt = purchase.purchaseToken
)4. Server-side reads
Backend services use the server client with a secret API key:
import { StubkitServerClient } from '@stubkit/js/server';
const stubkit = new StubkitServerClient({
apiKey: process.env.STUBKIT_API_KEY!,
appId: 'your-app',
});
const isPro = await stubkit.isActive(userId, 'pro');SDKs & Source
- @stubkit/js — JavaScript / TypeScript
- React Native / Expo — uses @stubkit/js (no separate package)
- stubkit-swift — iOS / macOS (Swift Package Manager v1.0.1)
- stubkit-kotlin — Android (JitPack v1.0.2)
- stubkit-flutter — Flutter / Dart (git ref v1.0.1)
What's next
- Configure provider webhooks: Apple, Google, Stripe
- Read how stubkit models entitlements
- Understand the state machine
- Full API reference