Display a paywall

Resolve the paywall assigned to a location and present it from your app.

Use this page to show a hosted paywall from the Kotlin SDK. A paywall is the screen a customer sees. A location is the stable slug your app asks for, such as onboarding or settings-upsell. You publish paywalls and assign them to locations in Studio, as described in Paywall locations.

Present it

Ask for a location, and the SDK presents whichever paywall is assigned to it. Pass a listener to be told about purchases, custom events, and dismissal.

val shown = voidhash.presentPaywall(activity, location = "settings-upsell", listener = object : PaywallListener {
    override fun onPurchaseCompleted(transaction: VoidhashTransaction) {}
    override fun onEvent(name: String, properties: Map<String, Any?>) {}
    override fun onDismiss() = Unit
})

presentPaywall resolves the paywall configured for the location and presents it fullscreen. It speaks the paywall bridge protocol natively, so purchases, restores, close, and external links are handled for you. Custom events and logs are forwarded to the listener.

The return value tells you what happened. It is false when no published paywall is assigned to the location, or when the client is disabled.

Purchases and restores started from a hosted paywall go through the same purchase pipeline as any other purchase. After a successful transaction, Voidhash refreshes the person snapshot and dismisses the paywall.

Fall back when nothing was shown

When you clear or archive a location in Studio, later presentations return false. Keep a fallback for important entry points so the customer still has a way to upgrade.

val shown = voidhash.presentPaywall(activity, location = "settings-upsell")

if (!shown) {
    showOwnUpgradeScreen()
}

Next steps