stubkit docs

Android quickstart

stubkit's Kotlin SDK wraps the Google Play Billing Library and syncs with the stubkit backend. This guide gets you from install to a working paywall in 15 minutes.

Install

// settings.gradle.kts — add JitPack repository
dependencyResolutionManagement {
    repositories {
        mavenCentral()
        maven { url = uri("https://jitpack.io") }
    }
}

// module build.gradle.kts
dependencies {
    implementation("com.github.stubkithq:stubkit-kotlin:1.0.2")
    implementation("com.android.billingclient:billing-ktx:7.0.0")
}

Configure

// Application.onCreate
StubkitPurchases.configure(
    context = this,
    apiKey = "pk_live_...",
    appId = "notesam",
    userId = currentUser.id
)

The userId is forwarded to Google via setObfuscatedAccountId so stubkit can attach renewals and refunds to the right user.

Show the paywall (Compose)

StubkitPaywall(
    apiKey = "pk_live_...",
    appId = "notesam",
    slug = "default"
) { outcome ->
    when (outcome) {
        is PaywallOutcome.Purchased -> navigateHome()
        is PaywallOutcome.Cancelled -> Unit
        is PaywallOutcome.Failed -> showError(outcome.message)
    }
}

Check entitlements

val isPro = EntitlementCache.isActive(
    context = context,
    appId = "notesam",
    userId = userId,
    entitlementId = "pro"
)

Restore purchases

lifecycleScope.launch { StubkitPurchases.restore() }

Testing with internal track

Upload a signed release build to the Play Console under Testing → Internal testing, add your Google account as a tester, and install from the opt-in link. Sandbox purchases don't charge — make sure your test account is added to License testing in the Play Console.

Next steps