purchases / com.revenuecat.purchases

Package com.revenuecat.purchases

Package that contains all the SDK classes.



class Entitlement : Parcelable

An entitlement represents features or content that a user is "entitled" to. Entitlements are unlocked by having an active subscription or making a one-time purchase. Many different products can unlock. Most subscription apps only have one entitlement, unlocking all premium features. However, if you had two tiers of content such as premium and premium_plus, you would have 2 entitlements. A common and simple setup example is one entitlement with identifier pro, one offering monthly, with one product. See this link for more info


data class Offering : Parcelable

Most well monetized subscription apps provide many different offerings to purchase an entitlement. These are usually associated with different durations i.e. an annual plan and a monthly plan. See this link for more info


class PurchaserInfo : Parcelable

Class containing all information regarding the purchaser


class 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 PurchasesError : Parcelable

This class represents an error

Type Aliases


typealias CallbackCacheKey = List<String>


typealias EntitlementMapCallback = Pair<(Map<String, Entitlement>) -> Unit, (PurchasesError) -> Unit>


typealias PurchaserInfoCallback = Pair<(PurchaserInfo) -> Unit, (PurchasesError) -> Unit>

Extensions for External Classes




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

This function will alias two appUserIDs together.


fun Purchases.getEntitlementsWith(onError: ErrorFunction = onErrorStub, onSuccess: ReceiveEntitlementsSuccessFunction): Unit

Fetch the configured entitlements for this user. Entitlements allows you to configure your in-app products via RevenueCat and greatly simplifies management. See the guide for more info.


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

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


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

Get latest available purchaser info.


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

Gets the SKUDetails for the given list of subscription skus.


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

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.makePurchaseWith(activity: Activity, sku: String, skuType: String, oldSkus: ArrayList<String>, onError: ErrorFunction = onErrorStub, onSuccess: PurchaseCompletedSuccessFunction): Unit
fun Purchases.makePurchaseWith(activity: Activity, sku: String, skuType: String, onError: ErrorFunction = onErrorStub, onSuccess: PurchaseCompletedSuccessFunction): Unit

Make a purchase.


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

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


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

Restores purchases made with the current Play Store account for the current user. If you initialized Purchases with an appUserID any receipt tokens currently being used by other users of your app will not be restored. If you used an anonymous id, i.e. you initialized Purchases without an appUserID, any other anonymous users using the same purchases will be merged.