awaitPurchaseResult

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

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.

Return

A Result containing SuccessfulPurchase if successful, and PurchasesTransactionException in case of a failure.

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.


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

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.

Return

A Result containing SuccessfulPurchase if successful, and PurchasesTransactionException in case of a failure.

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.


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

Play Store only. Purchases subscriptionOption.

Return

A Result containing SuccessfulPurchase if successful, and PurchasesTransactionException in case of a failure.

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.


suspend fun <Error class: unknown class>.awaitPurchaseResult(storeProduct: <Error class: unknown class>, promotionalOffer: <Error class: unknown class>): Result<<Error class: unknown class>>

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.

Return

A Result containing SuccessfulPurchase if successful, and PurchasesTransactionException in case of a failure.

Parameters

storeProduct

The StoreProduct you wish to purchase.

promotionalOffer

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

See also

awaitPromotionalOffer

suspend fun <Error class: unknown class>.awaitPurchaseResult(packageToPurchase: <Error class: unknown class>, promotionalOffer: <Error class: unknown class>): Result<<Error class: unknown class>>

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.

Return

A Result containing SuccessfulPurchase if successful, and PurchasesTransactionException in case of a failure.

Parameters

packageToPurchase

The Package you wish to purchase.

promotionalOffer

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

See also

awaitPromotionalOffer