PaywallActivityLaunchIfNeededOptions

Configuration options for conditionally launching a paywall activity.

This class requires a display condition to be set - either requiredEntitlementIdentifier or shouldDisplayBlock. The paywall will only be shown when the condition is met.

Use the Builder to create an instance:

Example with entitlement check:

val options = PaywallActivityLaunchIfNeededOptions.Builder()
.setRequiredEntitlementIdentifier("premium")
.setOffering(offering)
.setCustomVariables(mapOf("user_name" to CustomVariableValue.String("John")))
.setPaywallDisplayCallback(callback)
.build()

launcher.launchIfNeededWithOptions(options)

Example with custom condition:

val options = PaywallActivityLaunchIfNeededOptions.Builder()
.setShouldDisplayBlock { customerInfo ->
customerInfo.entitlements.active.isEmpty()
}
.setOffering(offering)
.build()

launcher.launchIfNeededWithOptions(options)

Types

Link copied to clipboard