purchase

suspend fun purchase(activity: Activity, option: StorePurchaseOption, replacement: suspend (StorePurchaseOption) -> SubscriptionReplacement? = { null }): PurchaseResult?

Purchases an option, applying the subscription replacement policy chosen by the app.

Return

The purchase result, or null when the purchase did not start or failed. Failures are reported in state.

Parameters

activity

The activity that presents the purchase flow.

option

The purchase option to buy.

replacement

Returns the existing subscription to replace, or null for a new purchase.