Purchases

class Purchases

The app-wide entry point for Google Play purchases and Purpl entitlements.

Call configure once when the app starts and share the returned instance across the app.

Types

Link copied to clipboard
object Companion

Creates the SDK instance shared across the app process.

Properties

Link copied to clipboard

Customer information for current purchases, or null until the first store query completes.

Link copied to clipboard
val errors: SharedFlow<PurchasesException>

Diagnostic errors from automatic refreshes, acknowledgements, and fallbacks.

Link copied to clipboard

Remote paywall configuration updates that can also be applied to paywalls that are already open.

Link copied to clipboard

The app's local entitlement configuration, including discontinued products.

Functions

Link copied to clipboard

Returns completed current purchases, used to choose the existing purchase token when changing subscriptions.

Link copied to clipboard
fun close()

Explicitly closes the SDK connection and releases the shared instance.

Link copied to clipboard
suspend fun customerInfo(): CustomerInfo

Returns customer information after checking current store purchases and the server again.

Link copied to clipboard
suspend fun logIn(applicationAccountIdentifier: String): CustomerInfo
suspend fun logIn(applicationAccountIdentifier: String, email: String?): CustomerInfo
suspend fun logIn(applicationAccountIdentifier: String, email: String?, transferPurchases: Boolean): CustomerInfo
Link copied to clipboard
suspend fun logOut()
Link copied to clipboard
suspend fun paywallConfiguration(identifier: String, localeIdentifier: String = Locale.getDefault().toLanguageTag(), fallback: ResolvedPaywallConfiguration? = null): ResolvedPaywallConfiguration

Returns the paywall configuration for an identifier.

Link copied to clipboard

Returns the products defined in the local entitlement configuration.

Returns the options in a catalog that are currently available from Google Play, with their prices.

Link copied to clipboard
suspend fun purchase(activity: Activity, option: StorePurchaseOption, replacement: SubscriptionReplacement? = null): PurchaseResult

Presents the Google Play purchase flow, then verifies the entitlement and acknowledges the purchase.

Link copied to clipboard

Restores purchases for the current Google account and recovers unfinished processing.

Link copied to clipboard
fun subscriptionManagementUrl(productIdentifier: String? = null): String

Returns the URL of the Google Play subscription management screen.

Link copied to clipboard
suspend fun synchronizeEntitlements(requestIdentifier: String = java.util.UUID.randomUUID().toString()): EntitlementSynchronizationResult
Link copied to clipboard

Synchronizes current store purchases with the entitlement provider.