Skip to main content

Show a Placement

import com.encorekit.kmp.models.PresentationResult

val result = Encore.placement("cancel_flow").show()

when (result) {
    is PresentationResult.Granted -> {
        // User accepted the offer
    }
    is PresentationResult.NotGranted -> {
        // User dismissed or no offers — proceed with original flow
        proceedWithCancellation()
    }
}
The placement(id).show() pattern is consistent across all Encore SDKs.

Handlers

Register these once at app startup, after configure().

onPurchaseRequest

Called when a user accepts an offer that requires a purchase:
Encore.onPurchaseRequest { request ->
    yourBillingService.purchase(request.productId)
}

onPassthrough

Called when the user dismisses or no offers are available. Resume the original flow:
Encore.onPassthrough { placementId ->
    proceedWithCancellation()
}

onPurchaseComplete (Optional)

Fires after a native purchase completes (when no onPurchaseRequest handler is set):
Encore.onPurchaseComplete { result, productId ->
    // Sync purchase state with your subscription manager
}

Claim Control

Disable the claim button while a purchase is in progress:
Encore.placements.setClaimEnabled(false)
// ... after purchase completes
Encore.placements.setClaimEnabled(true)

Next Steps