@revenuecat/purchases-capacitor
v15.0.0
Published
Capacitor in-app purchases and subscriptions made easy. Support for iOS and Android.
Readme
@revenuecat/purchases-capacitor
The RevenueCat SDK for Capacitor. It wraps StoreKit and Google Play Billing and handles purchases, entitlements, and subscription status.
Docs · Install guide · SDK reference · Sample app · Changelog · Migration guide
Requirements
| Requirement | Minimum | |---|---| | Capacitor | 8.0.0 | | iOS | 15.0 | | Android | 7.0 (API level 24) | | Android compile SDK | API 35 | | Kotlin | 2.1.0 |
Capacitor 8 projects already meet the Android compile SDK and Kotlin minimums. The UI package has the same minimums as the core package.
Web isn't supported. In a browser, Purchases methods reject with the string Web not supported in this plugin. unless you turn on mocked results with Purchases.setMockWebResults.
Installation
The SDK requires Swift Package Manager (SPM) on iOS. In Capacitor 8, npx cap add ios creates an SPM project by default. If your iOS project uses CocoaPods, migrate it to SPM before you add or upgrade the SDK.
Install the SDK from npm and sync your native projects:
npm install @revenuecat/purchases-capacitor
npx cap syncTo show Paywalls or Customer Center, also add @revenuecat/purchases-capacitor-ui to package.json at the same version as @revenuecat/purchases-capacitor. After you add it, run npm install and npx cap sync again.
Then set up each platform:
- iOS: add the In-App Purchase capability to your app target in Xcode. App Store purchases need it; Test Store purchases don't.
- Android: set your Activity's
launchModetostandardorsingleTopinAndroidManifest.xml. Other modes can cancel a purchase when Google Play sends the user to their banking app to verify it. Capacitor's Android template setssingleTask, so change it.
| Package | What it's for | When you need it |
|---|---|---|
| @revenuecat/purchases-capacitor | Purchases, entitlements, subscription status | Always |
| @revenuecat/purchases-capacitor-ui | Paywalls and Customer Center | You show RevenueCat Paywalls or Customer Center |
Quick start
Before you start, create a RevenueCat project, connect your store or start with the Test Store, and add an entitlement. See the Quickstart.
Configure the SDK with the public API key for each platform. While you test, pass your Test Store API key instead, and only in debug builds. Call onDeviceReady once when your app starts; the install guide's Angular, React, and Vue.js examples show where that code goes.
import { Capacitor } from '@capacitor/core';
import { Purchases, LOG_LEVEL } from '@revenuecat/purchases-capacitor';
const onDeviceReady = async () => {
const platform = Capacitor.getPlatform();
if (platform !== 'ios' && platform !== 'android') {
return;
}
const apiKey = platform === 'ios' ? '<public_apple_api_key>' : '<public_google_api_key>';
await Purchases.setLogLevel({ level: LOG_LEVEL.DEBUG });
await Purchases.configure({ apiKey });
};Check whether the user has an active entitlement before you show a paywall:
const platform = Capacitor.getPlatform();
if (platform === 'ios' || platform === 'android') {
try {
const { customerInfo } = await Purchases.getCustomerInfo();
if (typeof customerInfo.entitlements.active['my_entitlement_identifier'] !== 'undefined') {
// Unlock that great "pro" content
}
} catch (error) {
// Error fetching customer info
}
}What's included
- Paywalls: build single-screen or multi-step paywalls in the dashboard, change them without an app update, and show them with the UI package.
- Customer Center: a self-service screen in the UI package where users cancel subscriptions, restore purchases, and contact support. Refunds and plan changes are iOS only.
- Placements: serve a different Offering at each paywall location in your app.
- Test Store: test purchases before you set up App Store Connect or the Google Play Console.
- In-app currency: read the current Customer's in-app currency balances.
- Redemption Links: unlock a web purchase in your app from a deep link.
- iOS subscription offers: promotional offers, the offer code redemption sheet, and win-back offers.
- Your own purchase code: set
purchasesAreCompletedBywhen your app completes purchases with its own code. On Android, that code must support Google Play Billing Library 9 (see Other Play Billing libraries in your app). - Trusted Entitlements: informational by default. The SDK checks a signature on entitlement data and reports the result in
customerInfo.entitlements.verificationwithout blocking access. Your app decides how to handle unverified entitlements. - Custom paywall impressions: call
trackCustomPaywallImpressionwhen your own paywall appears, so RevenueCat counts its impressions. RevenueCat Paywalls track them automatically.
Documentation
- Install guide: Android and iOS project setup, and how to import the SDK in Angular, React, and Vue.js.
- Configure the SDK: initialization, debug logs, switching between Test Store and real stores, and proxy settings.
- Displaying paywalls: present a paywall with
RevenueCatUI.presentPaywall, or only when the user has no active entitlement withpresentPaywallIfNeeded. - Testing purchases: Test Store and sandbox testing.
- Migration guide: changes in the current major version.
- SDK reference: every method and type in
@revenuecat/purchases-capacitor, generated from its TypeScript definitions. The UI package isn't included.
Using an AI coding agent
Your agent's training data is likely older than the current version of this SDK. Point it at current sources:
- llms.txt: an index of the docs. Add
.mdto any docs URL for a Markdown version. - RevenueCat MCP server: lets your agent read and change your RevenueCat project configuration.
- AI Toolkit: installs RevenueCat skills and the MCP server in one step.
- Releases: check the latest version before adding the dependency.
Sample apps
- purchase-tester: an Ionic React app with a button for most of the SDK's methods, including offerings, purchases, restores, win-back offers, and Customer attributes. It also presents Paywalls and Customer Center from the UI package.
Getting help
- Bugs: open an issue in this repo.
- Account or configuration questions: RevenueCat Support.
- Discussion: RevenueCat Community.
Contributing
This repository is published from the main branch and release tags of RevenueCat's internal development repository. Issues are tracked here. Pull requests are welcome: a maintainer reviews them here and brings accepted changes into the internal repository, so they can't be merged directly.
See the contributing guide.
Acknowledgment
This SDK started as CapGo's Capacitor plugin. CapGo transferred it to RevenueCat, which now maintains and supports it.
License
MIT. See LICENSE.
API reference
configure(...)getVirtualCurrencies()invalidateVirtualCurrenciesCache()getCachedVirtualCurrencies()parseAsWebPurchaseRedemption(...)redeemWebPurchase(...)setMockWebResults(...)setSimulatesAskToBuyInSandbox(...)addCustomerInfoUpdateListener(...)removeCustomerInfoUpdateListener(...)getOfferings()getCurrentOfferingForPlacement(...)syncAttributesAndOfferingsIfNeeded()getProducts(...)purchaseStoreProduct(...)purchaseDiscountedProduct(...)purchasePackage(...)purchaseSubscriptionOption(...)purchaseDiscountedPackage(...)restorePurchases()recordPurchase(...)getAppUserID()getStorefront()logIn(...)logOut()setLogLevel(...)setLogHandler(...)getCustomerInfo()syncPurchases()syncObserverModeAmazonPurchase(...)syncAmazonPurchase(...)enableAdServicesAttributionTokenCollection()isAnonymous()checkTrialOrIntroductoryPriceEligibility(...)getPromotionalOffer(...)getEligibleWinBackOffersForProduct(...)getEligibleWinBackOffersForPackage(...)purchaseProductWithWinBackOffer(...)purchasePackageWithWinBackOffer(...)invalidateCustomerInfoCache()presentCodeRedemptionSheet()setAttributes(...)setEmail(...)setPhoneNumber(...)setDisplayName(...)setPushToken(...)setProxyURL(...)collectDeviceIdentifiers()setAdjustID(...)setAppsflyerID(...)setFBAnonymousID(...)setMparticleID(...)setCleverTapID(...)setMixpanelDistinctID(...)setFirebaseAppInstanceID(...)setOnesignalID(...)setOnesignalUserID(...)setSingularDeviceID(...)setAirshipChannelID(...)setMediaSource(...)setCampaign(...)setAdGroup(...)setAd(...)setKeyword(...)setCreative(...)canMakePayments(...)beginRefundRequestForActiveEntitlement()beginRefundRequestForEntitlement(...)beginRefundRequestForProduct(...)showInAppMessages(...)isConfigured()overridePreferredUILocale(...)trackCustomPaywallImpression(...)- Interfaces
- Type Aliases
- Enums
configure(...)
configure(configuration: PurchasesConfiguration) => Promise<void>Sets up Purchases with your API key and an app user id.
| Param | Type | Description |
| ------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| configuration | PurchasesConfiguration | RevenueCat configuration object including the API key and other optional parameters. See {@link PurchasesConfiguration} |
getVirtualCurrencies()
getVirtualCurrencies() => Promise<{ virtualCurrencies: PurchasesVirtualCurrencies; }>Fetches the virtual currencies for the current subscriber.
Returns: Promise<{ virtualCurrencies: PurchasesVirtualCurrencies; }>
invalidateVirtualCurrenciesCache()
invalidateVirtualCurrenciesCache() => Promise<void>Invalidates the cache for virtual currencies.
This is useful for cases where a virtual currency's balance might have been updated outside of the app, like if you decreased a user's balance from the user spending a virtual currency, or if you increased the balance from your backend using the server APIs.
getCachedVirtualCurrencies()
getCachedVirtualCurrencies() => Promise<{ cachedVirtualCurrencies: PurchasesVirtualCurrencies | null; }>The currently cached {@link PurchasesVirtualCurrencies} if one is available. This value will remain null until virtual currencies have been fetched at least once with {@link getVirtualCurrencies} or an equivalent function.
Returns: Promise<{ cachedVirtualCurrencies: PurchasesVirtualCurrencies | null; }>
parseAsWebPurchaseRedemption(...)
parseAsWebPurchaseRedemption(options: { urlString: string; }) => Promise<{ webPurchaseRedemption: WebPurchaseRedemption | null; }>Parses the given URL string into a [WebPurchaseRedemption] object that can be used to redeem web purchases.
| Param | Type | Description |
| ------------- | ----------------------------------- | --------------------------------------- |
| options | { urlString: string; } | Set the urlString used to open the App. |
Returns: Promise<{ webPurchaseRedemption: WebPurchaseRedemption | null; }>
redeemWebPurchase(...)
redeemWebPurchase(options: { webPurchaseRedemption: WebPurchaseRedemption; }) => Promise<WebPurchaseRedemptionResult>Redeems the web purchase associated with the Redemption Link obtained with [parseAsWebPurchaseRedemption].
| Param | Type | Description |
| ------------- | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| options | { webPurchaseRedemption: WebPurchaseRedemption; } | The WebPurchaseRedemption object obtained from {@link parseAsWebPurchaseRedemption}. |
Returns: Promise<WebPurchaseRedemptionResult>
setMockWebResults(...)
setMockWebResults(options: { shouldMockWebResults: boolean; }) => Promise<void>Sets whether the SDK should return mocked results in the web version. This won't affect the iOS and Android versions of the implementation. Default is false
| Param | Type | Description |
| ------------- | ----------------------------------------------- | --------------------------------------------------------------------------------------- |
| options | { shouldMockWebResults: boolean; } | Set shouldMockWebResults to true if you want the plugin methods to return mocked values |
setSimulatesAskToBuyInSandbox(...)
setSimulatesAskToBuyInSandbox(options: { simulatesAskToBuyInSandbox: boolean; }) => Promise<void>iOS only.
| Param | Type | Description |
| ------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| options | { simulatesAskToBuyInSandbox: boolean; } | Set this property to true only when testing the ask-to-buy / SCA purchases flow. More information: http://errors.rev.cat/ask-to-buy |
addCustomerInfoUpdateListener(...)
addCustomerInfoUpdateListener(customerInfoUpdateListener: CustomerInfoUpdateListener) => Promise<PurchasesCallbackId>Sets a function to be called on updated customer info
| Param | Type | Description |
| -------------------------------- | --------------------------------------------------------------------------------- | -------------------------------------------------------- |
| customerInfoUpdateListener | CustomerInfoUpdateListener | CustomerInfo update listener |
Returns: Promise<string>
removeCustomerInfoUpdateListener(...)
removeCustomerInfoUpdateListener(options: { listenerToRemove: PurchasesCallbackId; }) => Promise<{ wasRemoved: boolean; }>Removes a given CustomerInfoUpdateListener
| Param | Type | Description |
| ------------- | ------------------------------------------ | --------------------------------------------------------------------------------------------------- |
| options | { listenerToRemove: string; } | Include listenerToRemove, which is a CustomerInfoUpdateListener reference of the listener to remove |
Returns: Promise<{ wasRemoved: boolean; }>
getOfferings()
getOfferings() => Promise<PurchasesOfferings>Gets the map of entitlements -> offerings -> products
Returns: Promise<PurchasesOfferings>
getCurrentOfferingForPlacement(...)
getCurrentOfferingForPlacement(options: { placementIdentifier: string; }) => Promise<PurchasesOffering | null>Retrieves a current offering for a placement identifier, use this to access offerings defined by targeting placements configured in the RevenueCat dashboard.
| Param | Type |
| ------------- | --------------------------------------------- |
| options | { placementIdentifier: string; } |
Returns: Promise<PurchasesOffering | null>
syncAttributesAndOfferingsIfNeeded()
syncAttributesAndOfferingsIfNeeded() => Promise<PurchasesOfferings>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.
Returns: Promise<PurchasesOfferings>
getProducts(...)
getProducts(options: GetProductOptions) => Promise<{ products: PurchasesStoreProduct[]; }>Fetch the product info
| Param | Type |
| ------------- | --------------------------------------------------------------- |
| options | GetProductOptions |
Returns: Promise<{ products: PurchasesStoreProduct[]; }>
purchaseStoreProduct(...)
purchaseStoreProduct(options: PurchaseStoreProductOptions) => Promise<MakePurchaseResult>Make a purchase
| Param | Type |
| ------------- | ----------------------------------------------------------------------------------- |
| options | PurchaseStoreProductOptions |
Returns: Promise<MakePurchaseResult>
purchaseDiscountedProduct(...)
purchaseDiscountedProduct(options: PurchaseDiscountedProductOptions) => Promise<MakePurchaseResult>iOS only. Purchase a product applying a given discount.
| Param | Type |
| ------------- | --------------------------------------------------------------------------------------------- |
| options | PurchaseDiscountedProductOptions |
Returns: Promise<MakePurchaseResult>
purchasePackage(...)
purchasePackage(options: PurchasePackageOptions) => Promise<MakePurchaseResult>Make a purchase
| Param | Type |
| ------------- | ------------------------------------------------------------------------- |
| options | PurchasePackageOptions |
Returns: Promise<MakePurchaseResult>
purchaseSubscriptionOption(...)
purchaseSubscriptionOption(options: PurchaseSubscriptionOptionOptions) => Promise<MakePurchaseResult>Google only. Make a purchase of a subscriptionOption
| Param | Type |
| ------------- | ----------------------------------------------------------------------------------------------- |
| options | PurchaseSubscriptionOptionOptions |
Returns: Promise<MakePurchaseResult>
purchaseDiscountedPackage(...)
purchaseDiscountedPackage(options: PurchaseDiscountedPackageOptions) => Promise<MakePurchaseResult>iOS only. Purchase a package applying a given discount.
| Param | Type |
| ------------- | --------------------------------------------------------------------------------------------- |
| options | PurchaseDiscountedPackageOptions |
Returns: Promise<MakePurchaseResult>
restorePurchases()
restorePurchases() => Promise<{ customerInfo: CustomerInfo; }>Restores a user's previous purchases and links their appUserIDs to any user's also using those purchases.
Returns: Promise<{ customerInfo: CustomerInfo; }>
recordPurchase(...)
recordPurchase(options: { productID: string; }) => Promise<{ transaction: PurchasesStoreTransaction; }>Use this method only if you already have your own IAP implementation using StoreKit 2 and want to use RevenueCat's backend. If you are using StoreKit 1 for your implementation, you do not need this method.
You only need to use this method with new purchases. Subscription updates are observed automatically.
| Param | Type | Description |
| ------------- | ----------------------------------- | ----------------------------------------------------------------------------------- |
| options | { productID: string; } | The productID that was purchased that needs to be synced with RevenueCat's backend. |
Returns: Promise<{ transaction: PurchasesStoreTransaction; }>
getAppUserID()
getAppUserID() => Promise<{ appUserID: string; }>Get the appUserID
Returns: Promise<{ appUserID: string; }>
getStorefront()
getStorefront() => Promise<Storefront>Gets the storefront for the current store account.
Returns: Promise<Storefront>
logIn(...)
logIn(options: { appUserID: string; }) => Promise<LogInResult>This function will log in the current user with an appUserID. Typically, this would be used after a log in to identify a user without calling configure.
| Param | Type | Description |
| ------------- | ----------------------------------- | ------------------------------------------------------- |
| options | { appUserID: string; } | The appUserID that should be linked to the current user |
Returns: Promise<LogInResult>
logOut()
logOut() => Promise<{ customerInfo: CustomerInfo; }>Logs out the Purchases client clearing the saved appUserID. This will generate a random user id and save it in the cache.
Returns: Promise<{ customerInfo: CustomerInfo; }>
setLogLevel(...)
setLogLevel(options: { level: LOG_LEVEL; }) => Promise<void>Used to set the log level. Useful for debugging issues with the lovely team @RevenueCat. The default is {LOG_LEVEL.INFO} in release builds and {LOG_LEVEL.DEBUG} in debug builds.
| Param | Type | Description |
| ------------- | ----------------------------------------------------------- | --------------------------------- |
| options | { level: LOG_LEVEL; } | Log level to use to display logs. |
setLogHandler(...)
setLogHandler(logHandler: LogHandler) => Promise<void>Set a custom log handler for redirecting logs to your own logging system. By default, this sends info, warning, and error messages. If you wish to receive Debug level messages, see [setLogLevel].
| Param | Type | Description |
| ---------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| logHandler | LogHandler | It will get called for each log event. Use this function to redirect the log to your own logging system |
getCustomerInfo()
getCustomerInfo() => Promise<{ customerInfo: CustomerInfo; }>Gets current customer info
Returns: Promise<{ customerInfo: CustomerInfo; }>
syncPurchases()
syncPurchases() => Promise<void>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, like after a successful purchase.
syncObserverModeAmazonPurchase(...)
syncObserverModeAmazonPurchase(options: SyncObserverModeAmazonPurchaseOptions) => Promise<void>| Param | Type |
| ------------- | ------------------------------------------------------------------------------------------------------- |
| options | SyncObserverModeAmazonPurchaseOptions |
syncAmazonPurchase(...)
syncAmazonPurchase(options: SyncAmazonPurchaseOptions) => Promise<void>This method will send a purchase to the RevenueCat backend. This function should only be called if you are in Amazon observer mode or performing a client side migration of your current users to RevenueCat.
The receipt IDs are cached if successfully posted, so they are not posted more than once.
purchaseTime is required and can be obtained from Amazon's PurchaseResponse > Receipt > purchaseTime.
| Param | Type |
| ------------- | ------------------------------------------------------------------------------- |
| options | SyncAmazonPurchaseOptions |
enableAdServicesAttributionTokenCollection()
enableAdServicesAttributionTokenCollection() => Promise<void>Enable automatic collection of Apple Search Ad attribution on iOS. Disabled by default. Supported in iOS 14.3+ only
isAnonymous()
isAnonymous() => Promise<{ isAnonymous: boolean; }>Returns: Promise<{ isAnonymous: boolean; }>
checkTrialOrIntroductoryPriceEligibility(...)
checkTrialOrIntroductoryPriceEligibility(options: { productIdentifiers: string[]; }) => Promise<{ [productId: string]: IntroEligibility; }>iOS only. Computes whether a user is eligible for the introductory pricing period of a given product. You should use this method to determine whether you show the user the normal product price or the introductory price. This also applies to trials (trials are considered a type of introductory pricing).
| Param | Type | Description |
| ------------- | ---------------------------------------------- | ---------------------------------------------------------------------- |
| options | { productIdentifiers: string[]; } | Array of product identifiers for which you want to compute eligibility |
Returns: Promise<{ [productId: string]: IntroEligibility; }>
getPromotionalOffer(...)
getPromotionalOffer(options: GetPromotionalOfferOptions) => Promise<PurchasesPromotionalOffer | undefined>iOS only. Use this function to retrieve the PurchasesPromotionalOffer for a given PurchasesPackage.
| Param | Type |
| ------------- | --------------------------------------------------------------------------------- |
| options | GetPromotionalOfferOptions |
Returns: Promise<PurchasesPromotionalOffer>
getEligibleWinBackOffersForProduct(...)
getEligibleWinBackOffersForProduct(options: GetEligibleWinBackOffersForProductOptions) => Promise<{ eligibleWinBackOffers: PurchasesWinBackOffer[]; }>iOS only, requires iOS 18.0 or greater with StoreKit 2. Use this function to retrieve
the eligible PurchasesWinBackOffers that a subscriber is eligible for for a
given PurchasesStoreProduct.
| Param | Type |
| ------------- | --------------------------------------------------------------------------------------------------------------- |
| options | GetEligibleWinBackOffersForProductOptions |
Returns: Promise<{ eligibleWinBackOffers: PurchasesWinBackOffer[]; }>
getEligibleWinBackOffersForPackage(...)
getEligibleWinBackOffersForPackage(options: GetEligibleWinBackOffersForPackageOptions) => Promise<{ eligibleWinBackOffers: PurchasesWinBackOffer[]; }>iOS only, requires iOS 18.0 or greater with StoreKit 2. Use this function to retrieve
the eligible PurchasesWinBackOffers that a subscriber is eligible for for a
given PurchasesStorePackage.
| Param | Type |
| ------------- | --------------------------------------------------------------------------------------------------------------- |
| options | GetEligibleWinBackOffersForPackageOptions |
Returns: Promise<{ eligibleWinBackOffers: PurchasesWinBackOffer[]; }>
purchaseProductWithWinBackOffer(...)
purchaseProductWithWinBackOffer(options: PurchaseProductWithWinBackOfferOptions) => Promise<MakePurchaseResult | undefined>iOS only, requires iOS 18.0 or greater with StoreKit 2. Purchase a product applying a given win-back offer.
| Param | Type |
| ------------- | --------------------------------------------------------------------------------------------------------- |
| options | PurchaseProductWithWinBackOfferOptions |
Returns: Promise<MakePurchaseResult>
purchasePackageWithWinBackOffer(...)
purchasePackageWithWinBackOffer(options: PurchasePackageWithWinBackOfferOptions) => Promise<MakePurchaseResult | undefined>iOS only, requires iOS 18.0 or greater with StoreKit 2. Purchase a package applying a given win-back offer.
| Param | Type |
| ------------- | --------------------------------------------------------------------------------------------------------- |
| options | PurchasePackageWithWinBackOfferOptions |
Returns: Promise<MakePurchaseResult>
invalidateCustomerInfoCache()
invalidateCustomerInfoCache() => Promise<void>Invalidates the cache for customer information.
Most apps will not need to use this method; invalidating the cache can leave your app in an invalid state. Refer to https://docs.revenuecat.com/docs/customer-info#section-get-user-information for more information on using the cache properly.
This is useful for cases where customer information might have been updated outside the app, like if a promotional subscription is granted through the RevenueCat dashboard.
presentCodeRedemptionSheet()
presentCodeRedemptionSheet() => Promise<void>iOS 14.0+ only. Presents a code redemption sheet, useful for redeeming offer codes Refer to https://docs.revenuecat.com/docs/ios-subscription-offers#offer-codes for more information on how to configure and use offer codes
setAttributes(...)
setAttributes(attributes: { [key: string]: string | null; }) => Promise<void>Subscriber attributes are useful for storing additional, structured information on a user. Since attributes are writable using a public key they should not be used for managing secure or sensitive information such as subscription status, coins, etc.
Key names starting with "$" are reserved names used by RevenueCat. For a full list of key restrictions refer to our guide: https://docs.revenuecat.com/docs/subscriber-attributes
| Param | Type | Description |
| ---------------- | ----------------------------------------------- | ---------------------------------------------------------------------------------- |
| attributes | { [key: string]: string | null; } | Map of attributes by key. Set the value as an empty string to delete an attribute. |
setEmail(...)
setEmail(options: { email: string | null; }) => Promise<void>Subscriber attribute associated with the email address for the user
| Param | Type | Description |
| ------------- | --------------------------------------- | ---------------------------------------------------------- |
| options | { email: string | null; } | Empty String or null will delete the subscriber attribute. |
setPhoneNumber(...)
setPhoneNumber(options: { phoneNumber: string | null; }) => Promise<void>Subscriber attribute associated with the phone number for the user
| Param | Type | Description |
| ------------- | --------------------------------------------- | ---------------------------------------------------------- |
| options | { phoneNumber: string | null; } | Empty String or null will delete the subscriber attribute. |
setDisplayName(...)
setDisplayName(options: { displayName: string | null; }) => Promise<void>Subscriber attribute associated with the display name for the user
| Param | Type | Description |
| ------------- | --------------------------------------------- | ---------------------------------------------------------- |
| options | { displayName: string | null; } | Empty String or null will delete the subscriber attribute. |
setPushToken(...)
setPushToken(options: { pushToken: string | null; }) => Promise<void>Subscriber attribute associated with the push token for the user
| Param | Type | Description |
| ------------- | ------------------------------------------- | ------------------------------------------ |
| options | { pushToken: string | null; } | null will delete the subscriber attribute. |
setProxyURL(...)
setProxyURL(options: { url: string; }) => Promise<void>Set this property to your proxy URL before configuring Purchases only if you've received a proxy key value from your RevenueCat contact.
| Param | Type |
| ------------- | ----------------------------- |
| options | { url: string; } |
collectDeviceIdentifiers()
collectDeviceIdentifiers() => Promise<void>Automatically collect subscriber attributes associated with the device identifiers. $idfa, $idfv, $ip on iOS $gpsAdId, $androidId, $ip on Android
setAdjustID(...)
setAdjustID(options: { adjustID: string | null; }) => Promise<void>Subscriber attribute associated with the Adjust ID for the user Required for the RevenueCat Adjust integration
| Param | Type | Description |
| ------------- | ------------------------------------------ | -------------------------------------------------------------------------------------------------- |
| options | { adjustID: string | null; } | Adjust ID to use in Adjust integration. Empty String or null will delete the subscriber attribute. |
setAppsflyerID(...)
setAppsflyerID(options: { appsflyerID: string | null; }) => Promise<void>Subscriber attribute associated with the AppsFlyer ID for the user Required for the RevenueCat AppsFlyer integration
| Param | Type | Description |
| ------------- | --------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| options | { appsflyerID: string | null; } | Appsflyer ID to use in Appsflyer integration. Empty String or null will delete the subscriber attribute. |
setFBAnonymousID(...)
setFBAnonymousID(options: { fbAnonymousID: string | null; }) => Promise<void>Subscriber attribute associated with the Facebook SDK Anonymous ID for the user Recommended for the RevenueCat Facebook integration
| Param | Type | Description |
| ------------- | ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| options | { fbAnonymousID: string | null; } | Facebook Anonymous ID to use in Mparticle integration. Empty String or null will delete the subscriber attribute. |
setMparticleID(...)
setMparticleID(options: { mparticleID: string | null; }) => Promise<void>Subscriber attribute associated with the mParticle ID for the user Recommended for the RevenueCat mParticle integration
| Param | Type | Description |
| ------------- | --------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| options | { mparticleID: string | null; } | Mparticle ID to use in Mparticle integration. Empty String or null will delete the subscriber attribute. |
setCleverTapID(...)
setCleverTapID(options: { cleverTapID: string | null; }) => Promise<void>Subscriber attribute associated with the CleverTap ID for the user Required for the RevenueCat CleverTap integration
| Param | Type | Description |
| ------------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| options | { cleverTapID: string | null; } | CleverTap user ID to use in CleverTap integration. Empty String or null will delete the subscriber attribute. |
setMixpanelDistinctID(...)
setMixpanelDistinctID(options: { mixpanelDistinctID: string | null; }) => Promise<void>Subscriber attribute associated with the Mixpanel Distinct ID for the user Required for the RevenueCat Mixpanel integration
| Param | Type | Description |
| ------------- | ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| options | { mixpanelDistinctID: string | null; } | Mixpanel Distinct ID to use in Mixpanel integration. Empty String or null will delete the subscriber attribute. |
setFirebaseAppInstanceID(...)
setFirebaseAppInstanceID(options: { firebaseAppInstanceID: string | null; }) => Promise<void>Subscriber attribute associated with the Firebase App Instance ID for the user Required for the RevenueCat Firebase integration
| Param | Type | Description |
| ------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| options | { firebaseAppInstanceID: string | null; } | Firebase App Instance ID to use in Firebase integration. Empty String or null will delete the subscriber attribute. |
setOnesignalID(...)
setOnesignalID(options: { onesignalID: string | null; }) => Promise<void>Subscriber attribute associated with the OneSignal Player ID for the user Required for the RevenueCat OneSignal integration. Deprecated for OneSignal versions above v9.0.
| Param | Type | Description |
| ------------- | --------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| options | { onesignalID: string | null; } | OneSignal Player ID to use in OneSignal integration. Empty String or null will delete the subscriber attribute. |
setOnesignalUserID(...)
setOnesignalUserID(options: { onesignalUserID: string | null; }) => Promise<void>Subscriber attribute associated with the OneSignal User ID for the user Required for the RevenueCat OneSignal integration with versions v11.0 and above.
| Param | Type | Description |
| ------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| options | { onesignalUserID: string | null; } | OneSignal UserId to use in OneSignal integration. Empty String or null will delete the subscriber attribute. |
setSingularDeviceID(...)
setSingularDeviceID(options: { singularDeviceID: string | null; }) => Promise<void>Subscriber attribute associated with the Singular Device ID (SDID) for the user Required for the RevenueCat Singular integration when using Singular's Event Endpoint V2. The SDID is generated by the Singular SDK and cannot be collected by collectDeviceIdentifiers, so it has to be forwarded by the app.
| Param | Type | Description |
| ------------- | -------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| options | { singularDeviceID: string | null; } | Singular device ID to use in the Singular integration. Empty String or null will delete the subscriber attribute. |
setAirshipChannelID(...)
setAirshipChannelID(options: { airshipChannelID: string | null; }) => Promise<void>Subscriber attribute associated with the Airship Channel ID for the user Required for the RevenueCat Airship integration
| Param | Type | Description |
| ------------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| options | { airshipChannelID: string | null; } | Airship Channel ID to use in Airship integration. Empty String or null will delete the subscriber attribute. |
setMediaSource(...)
setMediaSource(options: { mediaSource: string | null; }) => Promise<void>Subscriber attribute associated with the install media source for the user
| Param | Type | Description |
| ------------- | --------------------------------------------- | ---------------------------------------------------------- |
| options | { mediaSource: string | null; } | Empty String or null will delete the subscriber attribute. |
setCampaign(...)
setCampaign(options: { campaign: string | null; }) => Promise<void>Subscriber attribute associated with the install campaign for the user
| Param | Type | Description |
| ------------- | ------------------------------------------ | ---------------------------------------------------------- |
| options | { campaign: string | null; } | Empty String or null will delete the subscriber attribute. |
setAdGroup(...)
setAdGroup(options: { adGroup: string | null; }) => Promise<void>Subscriber attribute associated with the install ad group for the user
| Param | Type | Description |
| ------------- | ----------------------------------------- | ---------------------------------------------------------- |
| options | { adGroup: string | null; } | Empty String or null will delete the subscriber attribute. |
setAd(...)
setAd(options: { ad: string | null; }) => Promise<void>Subscriber attribute associated with the install ad for the user
| Param | Type | Description |
| ------------- | ------------------------------------ | ---------------------------------------------------------- |
| options | { ad: string | null; } | Empty String or null will delete the subscriber attribute. |
setKeyword(...)
setKeyword(options: { keyword: string | null; }) => Promise<void>Subscriber attribute associated with the install keyword for the user
| Param | Type | Description |
| ------------- | ----------------------------------------- | ---------------------------------------------------------- |
| options | { keyword: string | null; } | Empty String or null will delete the subscriber attribute. |
setCreative(...)
setCreative(options: { creative: string | null; }) => Promise<void>Subscriber attribute associated with the install ad creative for the user
| Param | Type | Description |
| ------------- | ------------------------------------------ | ---------------------------------------------------------- |
| options | { creative: string | null; } | Empty String or null will delete the subscriber attribute. |
canMakePayments(...)
canMakePayments(options?: { features?: BILLING_FEATURE[] | undefined; } | undefined) => Promise<{ canMakePayments: boolean; }>Check if billing is supported for the current user (meaning IN-APP purchases are supported) and optionally, whether a list of specified feature types are supported.
Note: Billing features are only relevant to Google Play Android users. For other stores and platforms, billing features won't be checked.
| Param | Type | Description |
| ------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| options | { features?: BILLING_FEATURE[]; } | An array of feature types to check for support. Feature types must be one of [BILLING_FEATURE]. By default, is an empty list and no specific feature support will be checked. |
Returns: Promise<{ canMakePayments: boolean; }>
beginRefundRequestForActiveEntitlement()
beginRefundRequestForActiveEntitlement() => Promise<{ refundRequestStatus: REFUND_REQUEST_STATUS; }>iOS 15+ only. Presents a refund request sheet in the current window scene for the latest transaction associated with the active entitlement.
If the request was unsuccessful, no active entitlements could be found for
the user, or multiple active entitlements were found for the user,
the promise will return an error.
If called in an unsupported platform (Android or iOS < 15), an UnsupportedPlatformException will be thrown.
Important: This method should only be used if your user can only have a single active entitlement at a given time.
If a user could have more than one entitlement at a time, use beginRefundRequestForEntitlement instead.
Returns: Promise<{ refundRequestStatus: REFUND_REQUEST_STATUS; }>
beginRefundRequestForEntitlement(...)
beginRefundRequestForEntitlement(options: { entitlementInfo: PurchasesEntitlementInfo; }) => Promise<{ refundRequestStatus: REFUND_REQUEST_STATUS; }>iOS 15+ only. Presents a refund request sheet in the current window scene for
the latest transaction associated with the entitlement.
If the request was unsuccessful, the promise will return an error.
If called in an unsupported platform (Android or iOS < 15), an UnsupportedPlatformException will be thrown.
| Param | Type | Description |
| ------------- | --------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
| options | { entitlementInfo: PurchasesEntitlementInfo; } | The entitlement to begin a refund request for. |
Returns: Promise<{ refundRequestStatus: REFUND_REQUEST_STATUS; }>
beginRefundRequestForProduct(...)
beginRefundRequestForProduct(options: { storeProduct: PurchasesStoreProduct; }) => Promise<{ refundRequestStatus: REFUND_REQUEST_STATUS; }>iOS 15+ only. Presents a refund request sheet in the current window scene for
the latest transaction associated with the product.
If the request was unsuccessful, the promise will return an error.
If called in an unsupported platform (Android or iOS < 15), an UnsupportedPlatformException will be thrown.
| Param | Type | Description |
| ------------- | ------------------------------------------------------------------------------------------ | ----------------------------------------------- |
| options | { storeProduct: PurchasesStoreProduct; } | The StoreProduct to begin a refund request for. |
Returns: Promise<{ refundRequestStatus: REFUND_REQUEST_STATUS; }>
showInAppMessages(...)
showInAppMessages(options?: { messageTypes?: IN_APP_MESSAGE_TYPE[] | undefined; } | undefined) => Promise<void>Shows in-app messages available from the App Store or Google Play. You need to disable messages from showing automatically using [PurchasesConfiguration.shouldShowInAppMessagesAutomatically].
Note: In iOS, this requires version 16+. In older versions the promise will be resolved successfully immediately.
| Param | Type | Description |
| ------------- | ------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| options | { messageTypes?: IN_APP_MESSAGE_TYPE[]; } | An array of message types that the stores can display inside your app. Values must be one of [IN_APP_MESSAGE_TYPE]. By default, is undefined and all message types will be shown. |
isConfigured()
isConfigured() => Promise<{ isConfigured: boolean; }>Check if configure has finished and Purchases has been configured.
Returns: Promise<{ isConfigured: boolean; }>
overridePreferredUILocale(...)
overridePreferredUILocale(options: { locale: string | null; }) => Promise<void>Override the preferred UI locale for RevenueCat UI components at runtime. This affects both API requests and UI rendering. If the locale changes, this will automatically clear the offerings cache and trigger a background refetch to get paywall templates with the correct localizations.
| Param | Type | Description |
| ------------- | ---------------------------------------- | ------------------------------------------------------------------------- |
| options | { locale: string | null; } | The locale string (e.g., "es-ES", "en-US") or null to use system default. |
trackCustomPaywallImpression(...)
trackCustomPaywallImpression(options?: TrackCustomPaywallImpressionOptions | undefined) => Promise<void>Tracks an impression of a custom paywall. Use this to record when a user views your custom paywall so that RevenueCat can track paywall analytics.
Call this method once per paywall display, ideally when the paywall first becomes visible to the user, not in callbacks that may fire multiple times for the same display.
| Param | Type | Description
