awaitPurchase

suspend fun <Error class: unknown class>.awaitPurchase(purchaseParams: PurchaseParams): PurchaseResult

Initiate a purchase with the given PurchaseParams. Initialized with an Activity either a Package, StoreProduct, or SubscriptionOption.

If a Package or StoreProduct is used to build the PurchaseParams, the StoreProduct.defaultOption will be purchased. StoreProduct.defaultOption is selected via the following logic:

  • Filters out offers with "rc-ignore-offer" tag

  • Uses SubscriptionOption with the longest free trial or cheapest first phase

  • Falls back to use base plan

Return

The StoreTransaction for this purchase and the updated CustomerInfo for this user.

Throws

with a PurchasesTransactionException if there's an error when purchasing and a userCancelled boolean that indicates if the user cancelled the purchase flow.