awaitPurchase

suspend fun Purchases.awaitPurchase(storeProduct: <Error class: unknown class>, isPersonalizedPrice: Boolean? = null, oldProductId: String? = null, replacementMode: <Error class: unknown class> = GoogleReplacementMode.WITHOUT_PRORATION): SuccessfulPurchase

Purchases storeProduct. On the Play Store, if storeProduct represents a subscription, upgrades from the subscription specified by oldProductId and chooses storeProduct's default SubscriptionOption.

The default SubscriptionOption logic:

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

  • Uses SubscriptionOption WITH longest free trial or cheapest first phase

  • Falls back to use base plan

If storeProduct represents a non-subscription, oldProductId and replacementMode will be ignored.

Parameters

storeProduct

The StoreProduct you wish to purchase.

isPersonalizedPrice

Play Store only, ignored otherwise. Optional boolean indicates personalized pricing on products available for purchase in the EU. For compliance with EU regulations. User will see "This price has been customize for you" in the purchase dialog when true. See developer.android.com for more info.

oldProductId

Play Store only, ignored otherwise. If this purchase is an upgrade from another product, provide the previous product ID here.

replacementMode

Play Store only, ignored otherwise. The replacement mode to use when upgrading from another product. This field is ignored, unless oldProductId is non-null.

Throws

PurchasesTransactionException

in case of an error.


suspend fun Purchases.awaitPurchase(packageToPurchase: <Error class: unknown class>, isPersonalizedPrice: Boolean? = null, oldProductId: String? = null, replacementMode: <Error class: unknown class> = GoogleReplacementMode.WITHOUT_PRORATION): SuccessfulPurchase

Purchases packageToPurchase. On the Play Store, if packageToPurchase represents a subscription, upgrades from the subscription specified by oldProductId and chooses the default SubscriptionOption from packageToPurchase.

The default SubscriptionOption logic:

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

  • Uses SubscriptionOption WITH longest free trial or cheapest first phase

  • Falls back to use base plan

If packageToPurchase represents a non-subscription, oldProductId and replacementMode will be ignored.

Parameters

packageToPurchase

The Package you wish to purchase.

isPersonalizedPrice

Play Store only, ignored otherwise. Optional boolean indicates personalized pricing on products available for purchase in the EU. For compliance with EU regulations. User will see "This price has been customize for you" in the purchase dialog when true. See developer.android.com for more info.

oldProductId

Play Store only, ignored otherwise. If this purchase is an upgrade from another product, provide the previous product ID here.

replacementMode

Play Store only, ignored otherwise. The replacement mode to use when upgrading from another product. This field is ignored, unless oldProductId is non-null.

Throws

PurchasesTransactionException

in case of an error.


suspend fun Purchases.awaitPurchase(subscriptionOption: <Error class: unknown class>, isPersonalizedPrice: Boolean? = null, oldProductId: String? = null, replacementMode: <Error class: unknown class> = GoogleReplacementMode.WITHOUT_PRORATION): SuccessfulPurchase

Play Store only. Purchases subscriptionOption.

Parameters

subscriptionOption

The SubscriptionOption you wish to purchase.

isPersonalizedPrice

Play Store only, ignored otherwise. Optional boolean indicates personalized pricing on products available for purchase in the EU. For compliance with EU regulations. User will see "This price has been customize for you" in the purchase dialog when true. See developer.android.com for more info.

oldProductId

Play Store only, ignored otherwise. If this purchase is an upgrade from another product, provide the previous product ID here.

replacementMode

Play Store only, ignored otherwise. The replacement mode to use when upgrading from another product. This field is ignored, unless oldProductId is non-null.

Throws

PurchasesTransactionException

in case of an error.


suspend fun Purchases.awaitPurchase(storeProduct: <Error class: unknown class>, promotionalOffer: <Error class: unknown class>): SuccessfulPurchase

App Store only. Use this function if you are not using the Offerings system to purchase a StoreProduct with an applied PromotionalOffer. If you are using the Offerings system, use the overload with a Package parameter instead.

Parameters

storeProduct

The StoreProduct you wish to purchase.

promotionalOffer

The PromotionalOffer to apply to this purchase. StoreTransaction and updated CustomerInfo.

See also

Throws

PurchasesTransactionException

in case of an error.


suspend fun Purchases.awaitPurchase(packageToPurchase: <Error class: unknown class>, promotionalOffer: <Error class: unknown class>): SuccessfulPurchase

App Store only. Purchases packageToPurchase. Call this method when a user has decided to purchase a product with an applied discount. Only call this in direct response to user input. From here Purchases will handle the purchase with StoreKit.

Parameters

packageToPurchase

The Package you wish to purchase.

promotionalOffer

The PromotionalOffer to apply to this purchase. StoreTransaction and updated CustomerInfo.

See also

Throws

PurchasesTransactionException

in case of an error.