Skip to main content
Represents the result of showing an offer to a user. The result indicates whether the user was granted an offer or not.

Definition

sealed class PresentationResult {
    data class Granted(
        val offerId: String,
        val campaignId: String?
    ) : PresentationResult()

    data class NotGranted(
        val reason: NotGrantedReason
    ) : PresentationResult()
}

enum class NotGrantedReason(val value: String) {
    USER_CLOSED("user_closed"),
    NO_OFFERS("no_offer_available"),
    ERROR("error"),
}

Cases

CaseAssociated ValuesDescription
GrantedofferId: String, campaignId: String?User completed an offer flow (tapped CTA, opened link)
NotGrantedreason: NotGrantedReasonUser was not granted an offer

NotGrantedReason

ValueDescription
USER_CLOSEDUser explicitly dismissed the offer sheet
NO_OFFERSNo offers were available to show
ERRORAn error occurred during presentation

Usage

lifecycleScope.launch {
    val result = Encore.placement("cancel_flow").show()

    when (result) {
        is PresentationResult.Granted -> {
            Log.d("Encore", "Granted offer: ${result.offerId}")
        }
        is PresentationResult.NotGranted -> {
            Log.d("Encore", "Not granted: ${result.reason}")
            proceedWithCancellation()
        }
    }
}
When using the delegate handler pattern (onPurchaseRequest / onPassthrough), the SDK routes results automatically. PresentationResult is primarily used with the suspend show() variant for direct control flow.