Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • default

Index

Constructors

constructor

Properties

Static ATTRIBUTION_NETWORK

ATTRIBUTION_NETWORK: typeof ATTRIBUTION_NETWORK = ...

Enum for attribution networks

readonly

Static BILLING_FEATURE

BILLING_FEATURE: typeof BILLING_FEATURE = ...

Enum for billing features. Currently, these are only relevant for Google Play Android users: https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType

Static INTRO_ELIGIBILITY_STATUS

INTRO_ELIGIBILITY_STATUS: typeof INTRO_ELIGIBILITY_STATUS = ...

Enum of different possible states for intro price eligibility status.

readonly

Static PACKAGE_TYPE

PACKAGE_TYPE: typeof PACKAGE_TYPE = ...

Enumeration of all possible Package types.

readonly

Static PRORATION_MODE

PRORATION_MODE: typeof PRORATION_MODE = ...

Replace SKU's ProrationMode.

readonly

Static PURCHASE_TYPE

PURCHASE_TYPE: typeof PURCHASE_TYPE = ...

Supported SKU types.

readonly

Methods

Static addShouldPurchasePromoProductListener

  • Sets a function to be called on purchases initiated on the Apple App Store. This is only used in iOS.

    Parameters

    • shouldPurchasePromoProductListener: ShouldPurchasePromoProductListener

      Called when a user initiates a promotional in-app purchase from the App Store. If your app is able to handle a purchase at the current time, run the deferredPurchase function. If the app is not in a state to make a purchase: cache the deferredPurchase, then call the deferredPurchase when the app is ready to make the promotional purchase. If the purchase should never be made, you don't need to ever call the deferredPurchase and the app will not proceed with promotional purchases.

    Returns void

Static canMakePayments

  • canMakePayments(features?: BILLING_FEATURE[], callback: (canMakePayments: boolean) => void, errorCallback: (error: PurchasesError) => void): void
  • 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.

    Parameters

    Returns void

Static checkTrialOrIntroductoryPriceEligibility

  • checkTrialOrIntroductoryPriceEligibility(productIdentifiers: string[], callback: (map: {}) => void): void
  • iOS only. Computes whether or not a user is eligible for the introductory pricing period of a given product. You should use this method to determine whether or not 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).

    note

    Subscription groups are automatically collected for determining eligibility. If RevenueCat can't definitively compute the eligibility, most likely because of missing group information, it will return INTRO_ELIGIBILITY_STATUS_UNKNOWN. The best course of action on unknown status is to display the non-intro pricing, to not create a misleading situation. To avoid this, make sure you are testing with the latest version of iOS so that the subscription group can be collected by the SDK. Android always returns INTRO_ELIGIBILITY_STATUS_UNKNOWN.

    Parameters

    • productIdentifiers: string[]

      Array of product identifiers for which you want to compute eligibility

    • callback: (map: {}) => void

      Will be sent a map of IntroEligibility per productId

        • (map: {}): void

    Returns void

Static collectDeviceIdentifiers

  • collectDeviceIdentifiers(): void
  • Automatically collect subscriber attributes associated with the device identifiers. $idfa, $idfv, $ip on iOS $gpsAdId, $androidId, $ip on Android

    Returns void

Static configure

  • configure(apiKey: string, appUserID?: null | string, observerMode?: boolean, userDefaultsSuiteName?: string): void
  • Sets up Purchases with your API key and an app user id.

    Parameters

    • apiKey: string

      RevenueCat API Key. Needs to be a string

    • Optional appUserID: null | string

      A unique id for identifying the user

    • observerMode: boolean = false

      An optional boolean. Set this to TRUE if you have your own IAP implementation and want to use only RevenueCat's backend. Default is FALSE. If you are on Android and setting this to ON, you will have to acknowledge the purchases yourself.

    • Optional userDefaultsSuiteName: string

      An optional string. iOS-only, will be ignored for Android. Set this if you would like the RevenueCat SDK to store its preferences in a different NSUserDefaults suite, otherwise it will use standardUserDefaults. Default is null, which will make the SDK use standardUserDefaults.

    Returns void

Static enableAdServicesAttributionTokenCollection

  • enableAdServicesAttributionTokenCollection(): void
  • Enable automatic collection of Apple Search Ads attribution using AdServices. Disabled by default.

    Returns void

Static getAppUserID

  • getAppUserID(callback: (appUserID: string) => void): void
  • Get the appUserID that is currently in placed in the SDK

    Parameters

    • callback: (appUserID: string) => void

      Callback that will receive the current appUserID

        • (appUserID: string): void
        • Parameters

          • appUserID: string

          Returns void

    Returns void

Static getCustomerInfo

  • Gets the current customer info. This call will return the cached customer info unless the cache is stale, in which case, it will make a network call to retrieve it from the servers.

    Parameters

    • callback: (customerInfo: CustomerInfo) => void

      Callback that will receive the customer info

    • errorCallback: (error: PurchasesError) => void

      Callback that will be triggered whenever there is any problem retrieving the customer info

    Returns void

Static getOfferings

Static getProducts

  • Fetch the product info

    Parameters

    • productIdentifiers: string[]

      Array of product identifiers

    • callback: (products: PurchasesStoreProduct[]) => void

      Callback triggered after a successful getProducts call. It will receive an array of product objects.

    • errorCallback: (error: PurchasesError) => void

      Callback triggered after an error or when retrieving products

    • type: PURCHASE_TYPE = ...

      Optional type of products to fetch, can be inapp or subs. Subs by default

    Returns void

Static invalidateCustomerInfoCache

  • invalidateCustomerInfoCache(): 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 of the app, like if a promotional subscription is granted through the RevenueCat dashboard.

    Returns void

Static isAnonymous

  • isAnonymous(callback: (isAnonymous: boolean) => void): void
  • Parameters

    • callback: (isAnonymous: boolean) => void

      Will be sent a boolean indicating if the appUserID has been generated by RevenueCat or not.

        • (isAnonymous: boolean): void
        • Parameters

          • isAnonymous: boolean

          Returns void

    Returns void

Static logIn

  • logIn(appUserID: string, callback: (logInResult: LogInResult) => void, errorCallback: (error: PurchasesError) => void): void
  • This function will logIn the current user with an appUserID. Typically this would be used after a log in to identify a user without calling configure.

    Parameters

    • appUserID: string

      The appUserID that should be linked to the currently user

    • callback: (logInResult: LogInResult) => void

      Callback that will receive an object that contains the customerInfo after logging in, as well as a boolean indicating whether the user has just been created for the first time in the RevenueCat backend.

    • errorCallback: (error: PurchasesError) => void

      Callback that will be triggered whenever there is any problem logging in.

    Returns void

Static logOut

  • Logs out the Purchases client clearing the saved appUserID. This will generate a random user id and save it in the cache. If the current user is already anonymous, this will produce a PurchasesError.

    Parameters

    • callback: (customerInfo: CustomerInfo) => void

      Callback that will receive the new customer info after resetting

    • errorCallback: (error: PurchasesError) => void

      Callback that will be triggered whenever there is an error when logging out. This could happen for example if logOut is called but the current user is anonymous.

    Returns void

Static presentCodeRedemptionSheet

  • presentCodeRedemptionSheet(): void

Static purchasePackage

  • purchasePackage(aPackage: PurchasesPackage, callback: (__namedParameters: { customerInfo: CustomerInfo; productIdentifier: string }) => void, errorCallback: (__namedParameters: { error: PurchasesError; userCancelled: boolean }) => void, upgradeInfo?: null | UpgradeInfo): void
  • Make a purchase

    Parameters

    • aPackage: PurchasesPackage

      The Package you wish to purchase. You can get the Packages by calling getOfferings

    • callback: (__namedParameters: { customerInfo: CustomerInfo; productIdentifier: string }) => void

      Callback triggered after a successful purchase.

        • (__namedParameters: { customerInfo: CustomerInfo; productIdentifier: string }): void
        • Parameters

          • __namedParameters: { customerInfo: CustomerInfo; productIdentifier: string }

          Returns void

    • errorCallback: (__namedParameters: { error: PurchasesError; userCancelled: boolean }) => void

      Callback triggered after an error or when the user cancels the purchase. If user cancelled, userCancelled will be true

        • (__namedParameters: { error: PurchasesError; userCancelled: boolean }): void
    • Optional upgradeInfo: null | UpgradeInfo

      Android only. Optional UpgradeInfo you wish to upgrade from containing the oldSKU and the optional prorationMode.

    Returns void

Static purchaseProduct

  • purchaseProduct(productIdentifier: string, callback: (__namedParameters: { customerInfo: CustomerInfo; productIdentifier: string }) => void, errorCallback: (__namedParameters: { error: PurchasesError; userCancelled: boolean }) => void, upgradeInfo?: null | UpgradeInfo, type?: PURCHASE_TYPE): void
  • Make a purchase

    Parameters

    • productIdentifier: string

      The product identifier of the product you want to purchase.

    • callback: (__namedParameters: { customerInfo: CustomerInfo; productIdentifier: string }) => void

      Callback triggered after a successful purchase.

        • (__namedParameters: { customerInfo: CustomerInfo; productIdentifier: string }): void
        • Parameters

          • __namedParameters: { customerInfo: CustomerInfo; productIdentifier: string }

          Returns void

    • errorCallback: (__namedParameters: { error: PurchasesError; userCancelled: boolean }) => void

      Callback triggered after an error or when the user cancels the purchase. If user cancelled, userCancelled will be true

        • (__namedParameters: { error: PurchasesError; userCancelled: boolean }): void
    • Optional upgradeInfo: null | UpgradeInfo

      Android only. Optional UpgradeInfo you wish to upgrade from containing the oldSKU and the optional prorationMode.

    • type: PURCHASE_TYPE = ...

      Optional type of product, can be inapp or subs. Subs by default

    Returns void

Static removeShouldPurchasePromoProductListener

  • Removes a given ShouldPurchasePromoProductListener

    Parameters

    Returns boolean

    True if listener was removed, false otherwise

Static restorePurchases

  • Restores a user's previous purchases and links their appUserIDs to any user's also using those purchases.

    Parameters

    • callback: (customerInfo: CustomerInfo) => void

      Callback that will receive the new customer info after restoring transactions.

    • errorCallback: (error: PurchasesError) => void

      Callback that will be triggered whenever there is any problem restoring the user transactions. This gets normally triggered if there is an error retrieving the new customer info for the new user or the user cancelled the restore

    Returns void

Static setAd

  • setAd(ad: null | string): void
  • Subscriber attribute associated with the install ad for the user

    Parameters

    • ad: null | string

      Empty String or null will delete the subscriber attribute.

    Returns void

Static setAdGroup

  • setAdGroup(adGroup: null | string): void
  • Subscriber attribute associated with the install ad group for the user

    Parameters

    • adGroup: null | string

      Empty String or null will delete the subscriber attribute.

    Returns void

Static setAdjustID

  • setAdjustID(adjustID: null | string): void
  • Subscriber attribute associated with the Adjust Id for the user Required for the RevenueCat Adjust integration

    Parameters

    • adjustID: null | string

      Empty String or null will delete the subscriber attribute.

    Returns void

Static setAirshipChannelID

  • setAirshipChannelID(airshipChannelID: null | string): void
  • Subscriber attribute associated with the Airship Channel Id for the user Required for the RevenueCat Airship integration

    Parameters

    • airshipChannelID: null | string

      Empty String or null will delete the subscriber attribute.

    Returns void

Static setAppsflyerID

  • setAppsflyerID(appsflyerID: null | string): void
  • Subscriber attribute associated with the AppsFlyer Id for the user Required for the RevenueCat AppsFlyer integration

    Parameters

    • appsflyerID: null | string

      Empty String or null will delete the subscriber attribute.

    Returns void

Static setAttributes

  • setAttributes(attributes: {}): 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

    Parameters

    • attributes: {}

      Map of attributes by key. Set the value as an empty string to delete an attribute.

      • [key: string]: string | null

    Returns void

Static setAutomaticAppleSearchAdsAttributionCollection

  • setAutomaticAppleSearchAdsAttributionCollection(enabled: boolean): void
  • Enable automatic collection of Apple Search Ads attribution. Disabled by default.

    Parameters

    • enabled: boolean

      Enable or not automatic collection

    Returns void

Static setCampaign

  • setCampaign(campaign: null | string): void
  • Subscriber attribute associated with the install campaign for the user

    Parameters

    • campaign: null | string

      Empty String or null will delete the subscriber attribute.

    Returns void

Static setCleverTapID

  • setCleverTapID(cleverTapID: null | string): void
  • Subscriber attribute associated with the CleverTap ID for the user Required for the RevenueCat CleverTap integration

    Parameters

    • cleverTapID: null | string

      Empty String or null will delete the subscriber attribute.

    Returns void

Static setCreative

  • setCreative(creative: null | string): void
  • Subscriber attribute associated with the install ad creative for the user

    Parameters

    • creative: null | string

      Empty String or null will delete the subscriber attribute.

    Returns void

Static setDebugLogsEnabled

  • setDebugLogsEnabled(enabled: boolean): void
  • Enables/Disables debugs logs

    Parameters

    • enabled: boolean

      Enable or not debug logs

    Returns void

Static setDisplayName

  • setDisplayName(displayName: null | string): void
  • Subscriber attribute associated with the display name for the user

    Parameters

    • displayName: null | string

      Empty String or null will delete the subscriber attribute.

    Returns void

Static setEmail

  • setEmail(email: null | string): void
  • Subscriber attribute associated with the email address for the user

    Parameters

    • email: null | string

      Empty String or null will delete the subscriber attribute.

    Returns void

Static setFBAnonymousID

  • setFBAnonymousID(fbAnonymousID: null | string): void
  • Subscriber attribute associated with the Facebook SDK Anonymous Id for the user Recommended for the RevenueCat Facebook integration

    Parameters

    • fbAnonymousID: null | string

      Empty String or null will delete the subscriber attribute.

    Returns void

Static setFirebaseAppInstanceID

  • setFirebaseAppInstanceID(firebaseAppInstanceID: null | string): void
  • Subscriber attribute associated with the Firebase App Instance ID for the user Required for the RevenueCat Firebase integration

    Parameters

    • firebaseAppInstanceID: null | string

      Empty String or null will delete the subscriber attribute.

    Returns void

Static setKeyword

  • setKeyword(keyword: null | string): void
  • Subscriber attribute associated with the install keyword for the user

    Parameters

    • keyword: null | string

      Empty String or null will delete the subscriber attribute.

    Returns void

Static setMediaSource

  • setMediaSource(mediaSource: null | string): void
  • Subscriber attribute associated with the install media source for the user

    Parameters

    • mediaSource: null | string

      Empty String or null will delete the subscriber attribute.

    Returns void

Static setMixpanelDistinctID

  • setMixpanelDistinctID(mixpanelDistinctID: null | string): void
  • Subscriber attribute associated with the Mixpanel Distinct ID for the user Required for the RevenueCat Mixpanel integration

    Parameters

    • mixpanelDistinctID: null | string

      Empty String or null will delete the subscriber attribute.

    Returns void

Static setMparticleID

  • setMparticleID(mparticleID: null | string): void
  • Subscriber attribute associated with the mParticle Id for the user Recommended for the RevenueCat mParticle integration

    Parameters

    • mparticleID: null | string

      Empty String or null will delete the subscriber attribute.

    Returns void

Static setOnesignalID

  • setOnesignalID(onesignalID: null | string): void
  • Subscriber attribute associated with the OneSignal Player Id for the user Required for the RevenueCat OneSignal integration

    Parameters

    • onesignalID: null | string

      Empty String or null will delete the subscriber attribute.

    Returns void

Static setPhoneNumber

  • setPhoneNumber(phoneNumber: null | string): void
  • Subscriber attribute associated with the phone number for the user

    Parameters

    • phoneNumber: null | string

      Empty String or null will delete the subscriber attribute.

    Returns void

Static setProxyURL

  • setProxyURL(url: string): void
  • Set this property to your proxy URL before configuring Purchases only if you've received a proxy key value from your RevenueCat contact.

    Parameters

    • url: string

      Proxy URL as a string.

    Returns void

Static setPushToken

  • setPushToken(pushToken: null | string): void
  • Subscriber attribute associated with the push token for the user

    Parameters

    • pushToken: null | string

      Empty String or null will delete the subscriber attribute.

    Returns void

Static setSimulatesAskToBuyInSandbox

  • setSimulatesAskToBuyInSandbox(enabled: boolean): void
  • iOS only.

    Parameters

    • enabled: boolean

    Returns void

Static syncPurchases

  • syncPurchases(): 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.

    warning

    This function should only be called if you're not calling makePurchase.

    Returns void

Generated using TypeDoc