Package-level declarations

Types

Link copied to clipboard

Specifies the user consent status for Login with Amazon

Link copied to clipboard

Specifies behavior for a caching API.

Link copied to clipboard
data class CustomerInfo(val entitlements: EntitlementInfos, val allExpirationDatesByProduct: Map<String, Date?>, val allPurchaseDatesByProduct: Map<String, Date?>, val requestDate: Date, val schemaVersion: Int, val firstSeen: Date, val originalAppUserId: String, val managementURL: Uri?, val originalPurchaseDate: Date?, jsonObject: JSONObject) : Parcelable, RawDataContainer<JSONObject>

Class containing all information regarding the customer

Link copied to clipboard

Only use a Dangerous Setting if suggested by RevenueCat support team.

Link copied to clipboard
data class EntitlementInfo(val identifier: String, val isActive: Boolean, val willRenew: Boolean, val periodType: PeriodType, val latestPurchaseDate: Date, val originalPurchaseDate: Date, val expirationDate: Date?, val store: Store, val productIdentifier: String, val productPlanIdentifier: String?, val isSandbox: Boolean, val unsubscribeDetectedAt: Date?, val billingIssueDetectedAt: Date?, val ownershipType: OwnershipType, jsonObject: JSONObject, val verification: VerificationResult = VerificationResult.NOT_REQUESTED) : Parcelable, RawDataContainer<JSONObject>

This object gives you access to all of the information about the status of a user's entitlements.

Link copied to clipboard

This class contains all the entitlements associated to the user.

Link copied to clipboard

This annotation marks the experimental preview of the RevenueCat Purchases API. This API is in a preview state and has a very high chance of being changed in the future.

Link copied to clipboard
interface LogHandler

Interface that allows handling logs manually. See also Purchases.logHandler

Link copied to clipboard
Link copied to clipboard
data class Offering @JvmOverloads constructor(val identifier: String, val serverDescription: String, val metadata: Map<String, Any>, val availablePackages: List<Package>, val paywall: PaywallData? = null)

An offering is a collection of Package available for the user to purchase. For more info see https://docs.revenuecat.com/docs/entitlements

Link copied to clipboard
data class Offerings

This class contains all the offerings configured in RevenueCat dashboard. For more info see https://docs.revenuecat.com/docs/entitlements

Link copied to clipboard

Enum of supported ownership types for an entitlement.

Link copied to clipboard
data class Package(val identifier: String, val packageType: PackageType, val product: StoreProduct, val presentedOfferingContext: PresentedOfferingContext)

Contains information about the product available for the user to purchase. For more info see https://docs.revenuecat.com/docs/entitlements

Link copied to clipboard

Enumeration of all possible Package types.

Link copied to clipboard

Enum of supported period types for an entitlement.

Link copied to clipboard
data class PresentedOfferingContext @JvmOverloads constructor(val offeringIdentifier: String, val placementIdentifier: String?, val targetingContext: PresentedOfferingContext.TargetingContext?) : Parcelable

Contains data about the context in which an offering was presented.

Link copied to clipboard
Link copied to clipboard
data class PurchaseParams(val builder: PurchaseParams.Builder)
Link copied to clipboard
data class PurchaseResult(val storeTransaction: StoreTransaction, val customerInfo: CustomerInfo)

The result of a successful purchase operation. Used in coroutines.

Link copied to clipboard

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.

Link copied to clipboard

Modes for completing the purchase process.

Link copied to clipboard

Holds parameters to initialize the SDK. Create an instance of this class using the Builder and pass it to Purchases.configure.

Link copied to clipboard
class PurchasesError(val code: PurchasesErrorCode, val underlyingErrorMessage: String? = null) : Parcelable

This class represents an error

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
class PurchasesTransactionException(purchasesError: PurchasesError, val userCancelled: Boolean) : PurchasesException
Link copied to clipboard

Contains information about the replacement mode to use in case of a product upgrade. Use the platform specific subclasses in each implementation.

Link copied to clipboard
enum Store : Enum<Store>

Enum of supported stores

Link copied to clipboard

The result of the verification process.

Link copied to clipboard

Represents a web redemption link, that can be redeemed using Purchases.redeemWebPurchase

Functions

Link copied to clipboard

Gets the current user's CustomerCenterConfigData. Used by RevenueCatUI to present the customer center.

Link copied to clipboard
suspend fun Purchases.awaitCustomerInfo(fetchPolicy: CacheFetchPolicy = CacheFetchPolicy.default()): CustomerInfo

Get latest available customer info. Coroutine friendly version of Purchases.getCustomerInfo.

Link copied to clipboard
suspend fun <Error class: unknown class>.awaitGetProducts(productIds: List<String>, type: ProductType? = null): List<StoreProduct>

Gets the StoreProduct(s) for the given list of product ids of type type, or for all types if no type is specified.

Link copied to clipboard
suspend fun Purchases.awaitLogIn(appUserID: String): LogInResult

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

Link copied to clipboard

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

Link copied to clipboard
suspend fun <Error class: unknown class>.awaitOfferings(): Offerings

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

Link copied to clipboard
suspend fun <Error class: unknown class>.awaitPurchase(purchaseParams: PurchaseParams): PurchaseResult

Initiate a purchase with the given PurchaseParams. Initialized with an Activity either a Package, StoreProduct, or SubscriptionOption.

Link copied to clipboard
suspend fun <Error class: unknown class>.awaitRestore(): CustomerInfo

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.

Link copied to clipboard

Syncs subscriber attributes and then fetches the configured offerings for this user. This method is intended to be called when using Targeting Rules with Custom Attributes. Any subscriber attributes should be set before calling this method to ensure the returned offerings are applied with the latest subscriber attributes.

Link copied to clipboard

This method will send all the purchases to the RevenueCat backend. Call this when using your own implementation for subscriptions anytime a sync is needed, such as when migrating existing users to RevenueCat.

Link copied to clipboard

Note: This method only works for the Amazon Appstore. There is no Google equivalent at this time. Calling from a Google-configured app will always return AmazonLWAConsentStatus.UNAVAILABLE.

Link copied to clipboard
fun Purchases.getAmazonLWAConsentStatusWith(onError: (error: PurchasesError) -> Unit = ON_ERROR_STUB, onSuccess: (AmazonLWAConsentStatus) -> Unit)

Note: This method only works for the Amazon Appstore. There is no Google equivalent at this time. Calling from a Google-configured app will always return AmazonLWAConsentStatus.UNAVAILABLE.

Link copied to clipboard
fun Purchases.getCustomerInfoWith(onError: (error: PurchasesError) -> Unit = ON_ERROR_STUB, onSuccess: (customerInfo: CustomerInfo) -> Unit)

Get latest available customer info.

fun Purchases.getCustomerInfoWith(fetchPolicy: CacheFetchPolicy, onError: (error: PurchasesError) -> Unit = ON_ERROR_STUB, onSuccess: (customerInfo: CustomerInfo) -> Unit)

Get customer info from cache or network depending on fetch policy.

Link copied to clipboard
fun <Error class: unknown class>.getOfferingsWith(onError: (error: PurchasesError) -> Unit = ON_ERROR_STUB, onSuccess: (offerings: Offerings) -> Unit)

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.

Link copied to clipboard
fun <Error class: unknown class>.getProductsWith(productIds: List<String>, onError: (error: PurchasesError) -> Unit = ON_ERROR_STUB, onGetStoreProducts: (storeProducts: List<StoreProduct>) -> Unit)

Gets the StoreProduct(s) for the given list of product ids for all product types.

fun <Error class: unknown class>.getProductsWith(productIds: List<String>, type: ProductType?, onError: (error: PurchasesError) -> Unit = ON_ERROR_STUB, onGetStoreProducts: (storeProducts: List<StoreProduct>) -> Unit)

Gets the StoreProduct(s) for the given list of product ids of type type

Link copied to clipboard
fun Purchases.logInWith(appUserID: String, onError: (error: PurchasesError) -> Unit = ON_ERROR_STUB, onSuccess: (customerInfo: CustomerInfo, created: Boolean) -> 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

Link copied to clipboard
fun Purchases.logOutWith(onError: (error: PurchasesError) -> Unit = ON_ERROR_STUB, onSuccess: (customerInfo: CustomerInfo) -> Unit)

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

Link copied to clipboard
fun <Error class: unknown class>.purchaseWith(purchaseParams: PurchaseParams, onError: (error: PurchasesError, userCancelled: Boolean) -> Unit = ON_PURCHASE_ERROR_STUB, onSuccess: (purchase: StoreTransaction?, customerInfo: CustomerInfo) -> Unit)
Link copied to clipboard
fun <Error class: unknown class>.restorePurchasesWith(onError: (error: PurchasesError) -> Unit = ON_ERROR_STUB, onSuccess: (customerInfo: CustomerInfo) -> Unit)

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.

Link copied to clipboard
fun Purchases.syncAttributesAndOfferingsIfNeededWith(onError: (error: PurchasesError) -> Unit = ON_ERROR_STUB, onSuccess: (Offerings) -> Unit)

Syncs subscriber attributes and then fetches the configured offerings for this user. This method is intended to be called when using Targeting Rules with Custom Attributes. Any subscriber attributes should be set before calling this method to ensure the returned offerings are applied with the latest subscriber attributes.

Link copied to clipboard
fun Purchases.syncPurchasesWith(onError: (error: PurchasesError) -> Unit = ON_ERROR_STUB, onSuccess: (CustomerInfo) -> Unit)

This method will send all the purchases to the RevenueCat backend. Call this when using your own implementation for subscriptions anytime a sync is needed, such as when migrating existing users to RevenueCat. The onSuccess callback will be called if all purchases have been synced successfully or there are no purchases. Otherwise, the onError callback will be called with a PurchasesError indicating the first error found.