purchase

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.

Parameters

activity

The activity that presents the purchase flow.

option

The purchase option to buy.

replacement

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

Throws

If the purchase fails or its entitlement cannot be verified.