purchase
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"
tagUses 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
The StoreProduct you wish to purchase.
Will be called if the purchase has completed with an error, providing the PurchasesError and a boolean indicating whether the user canceled the purchase.
Will be called if the purchase has completed successfully, providing the StoreTransaction and updated CustomerInfo.
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.
Play Store only, ignored otherwise. If this purchase is an upgrade from another product, provide the previous product ID here.
Play Store only, ignored otherwise. The replacement mode to use when upgrading from another product. This field is ignored, unless oldProductId is non-null.
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"
tagUses 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
The Package you wish to purchase.
Will be called if the purchase has completed with an error, providing the PurchasesError and a boolean indicating whether the user canceled the purchase.
Will be called if the purchase has completed successfully, providing the StoreTransaction and updated CustomerInfo.
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.
Play Store only, ignored otherwise. If this purchase is an upgrade from another product, provide the previous product ID here.
Play Store only, ignored otherwise. The replacement mode to use when upgrading from another product. This field is ignored, unless oldProductId is non-null.
Play Store only. Purchases subscriptionOption.
Parameters
The SubscriptionOption you wish to purchase.
Will be called if the purchase has completed with an error, providing the PurchasesError and a boolean indicating whether the user canceled the purchase.
Will be called if the purchase has completed successfully, providing the StoreTransaction and updated CustomerInfo.
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.
Play Store only, ignored otherwise. If this purchase is an upgrade from another product, provide the previous product ID here.
Play Store only, ignored otherwise. The replacement mode to use when upgrading from another product. This field is ignored, unless oldProductId is non-null.
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
The StoreProduct you wish to purchase.
The PromotionalOffer to apply to this purchase.
Will be called if the purchase has completed with an error, providing the PurchasesError and a boolean indicating whether the user canceled the purchase.
Will be called if the purchase has completed successfully, providing the StoreTransaction and updated CustomerInfo.
See also
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 and call either onSuccess or onError.
Parameters
The Package you wish to purchase.
The PromotionalOffer to apply to this purchase.
Will be called if the purchase has completed with an error, providing the PurchasesError and a boolean indicating whether the user canceled the purchase.
Will be called if the purchase has completed successfully, providing the StoreTransaction and updated CustomerInfo.