purchaseProductWith

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

Purchase product.

Parameters

activity

Current activity

storeProduct

The storeProduct of the product you wish to purchase

onSuccess

Will be called after the purchase has completed

onError

Will be called after the purchase has completed with error


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

Make a purchase upgrading from a previous sku.

Parameters

activity

Current activity

storeProduct

The storeProduct of the product you wish to purchase

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 after the purchase has completed with error

Sources

Link copied to clipboard
Link copied to clipboard