purchaseSubscriptionOptionWith

fun Purchases.purchaseSubscriptionOptionWith(    activity: Activity,     storeProduct: StoreProduct,     subscriptionOption: SubscriptionOption,     onError: (error: PurchasesError, userCancelled: Boolean) -> Unit = ON_PURCHASE_ERROR_STUB,     onSuccess: (purchase: StoreTransaction, customerInfo: CustomerInfo) -> Unit)

Purchase a subscription StoreProduct's SubscriptionOption.

Parameters

activity

Current activity

storeProduct

The storeProduct of the product you wish to purchase

subscriptionOption

Your choice of SubscriptionOptions available for the subscription StoreProduct

onSuccess

Will be called after the purchase has completed

onError

Will be called if there was an error with the purchase


fun Purchases.purchaseSubscriptionOptionWith(    activity: Activity,     storeProduct: StoreProduct,     subscriptionOption: SubscriptionOption,     upgradeInfo: UpgradeInfo,     onError: (error: PurchasesError, userCancelled: Boolean) -> Unit = ON_PURCHASE_ERROR_STUB,     onSuccess: (purchase: StoreTransaction?, customerInfo: CustomerInfo) -> Unit)

Purchase a subscription StoreProduct's SubscriptionOption, upgrading from an old product.

Parameters

activity

Current activity

storeProduct

The storeProduct of the product you wish to purchase

subscriptionOption

Your choice of SubscriptionOptions available for the subscription StoreProduct

upgradeInfo

The upgradeInfo you wish to upgrade from, containing the oldSku and the optional prorationMode. Amazon Appstore doesn't support changing products so upgradeInfo is ignored for Amazon purchases.

onSuccess

Will be called after the purchase has completed

onError

Will be called if there was an error with the purchase

Sources

Link copied to clipboard
Link copied to clipboard