purchases / com.revenuecat.purchases

Package com.revenuecat.purchases

Package that contains all the SDK classes.

Types

BillingFactory

object BillingFactory

ErrorPurchaseCallback

typealias ErrorPurchaseCallback = (PurchaseDetails, PurchasesError) -> Unit

Purchases

Entry point for Purchases. It should be instantiated as soon as your app has a unique user id for your user. This can be when a user logs in if you have accounts or on launch if you can generate a random user identifier. Make sure you follow the quickstart guide to setup your RevenueCat account.

class Purchases : LifecycleDelegate

PurchasesConfiguration

open class PurchasesConfiguration

SuccessfulPurchaseCallback

typealias SuccessfulPurchaseCallback = (PurchaseDetails, PurchaserInfo) -> Unit

UpgradeInfo

This object holds the information used when upgrading from another sku.

data class UpgradeInfo

Functions

createAliasWith

This function will alias two appUserIDs together.

fun Purchases.createAliasWith(newAppUserID: String, onError: ErrorFunction = ON_ERROR_STUB, onSuccess: ReceivePurchaserInfoSuccessFunction): Unit

getNonSubscriptionSkusWith

Gets the SKUDetails for the given list of non-subscription skus.

fun Purchases.getNonSubscriptionSkusWith(skus: List<String>, onError: ErrorFunction, onReceiveSkus: (skus: List<SkuDetails>) -> Unit): Unit

getOfferingsWith

Fetch the configured offerings for this users. Offerings allows you to configure your in-app products vis RevenueCat and greatly simplifies management. See the guide for more info.

fun Purchases.getOfferingsWith(onError: ErrorFunction = ON_ERROR_STUB, onSuccess: ReceiveOfferingsSuccessFunction): Unit

getPurchaserInfoWith

Get latest available purchaser info.

fun Purchases.getPurchaserInfoWith(onError: ErrorFunction = ON_ERROR_STUB, onSuccess: ReceivePurchaserInfoSuccessFunction): Unit

getSubscriptionSkusWith

Gets the SKUDetails for the given list of subscription skus.

fun Purchases.getSubscriptionSkusWith(skus: List<String>, onError: ErrorFunction = ON_ERROR_STUB, onReceiveSkus: (skus: List<SkuDetails>) -> Unit): Unit

identifyWith

This function will change the current appUserID. Typically this would be used after a log out to identify a new user without calling configure

fun Purchases.identifyWith(appUserID: String, onError: ErrorFunction = ON_ERROR_STUB, onSuccess: ReceivePurchaserInfoSuccessFunction): Unit

purchasePackageWith

Make a purchase.

fun Purchases.purchasePackageWith(activity: Activity, packageToPurchase: Package, upgradeInfo: UpgradeInfo, onError: PurchaseErrorFunction = ON_PURCHASE_ERROR_STUB, onSuccess: ProductChangeCompletedFunction): Unit
fun Purchases.purchasePackageWith(activity: Activity, packageToPurchase: Package, onError: PurchaseErrorFunction = ON_PURCHASE_ERROR_STUB, onSuccess: PurchaseCompletedFunction): Unit

purchaseProductWith

Purchase product.

fun Purchases.purchaseProductWith(activity: Activity, skuDetails: SkuDetails, onError: PurchaseErrorFunction = ON_PURCHASE_ERROR_STUB, onSuccess: PurchaseCompletedFunction): Unit

Make a purchase.

fun Purchases.purchaseProductWith(activity: Activity, skuDetails: SkuDetails, upgradeInfo: UpgradeInfo, onError: PurchaseErrorFunction = ON_PURCHASE_ERROR_STUB, onSuccess: ProductChangeCompletedFunction): Unit

resetWith

Resets the Purchases client clearing the save appUserID. This will generate a random user id and save it in the cache.

fun Purchases.resetWith(onError: ErrorFunction = ON_ERROR_STUB, onSuccess: ReceivePurchaserInfoSuccessFunction): Unit

restorePurchasesWith

Restores purchases made with the current Play Store account for the current user. This method will post all purchases associated with the current Play Store account to RevenueCat and become associated with the current appUserID. If the receipt token is being used by an existing user, the current appUserID will be aliased together with the appUserID of the existing user. Going forward, either appUserID will be able to reference the same user.

fun Purchases.restorePurchasesWith(onError: ErrorFunction = ON_ERROR_STUB, onSuccess: ReceivePurchaserInfoSuccessFunction): Unit