Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • default

Index

Constructors

constructor

Properties

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

readonly

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 PURCHASES_ERROR_CODE

PURCHASES_ERROR_CODE: typeof PURCHASES_ERROR_CODE = ...

Enum of all error codes the SDK produces.

readonly

Static PURCHASE_TYPE

PURCHASE_TYPE: typeof PURCHASE_TYPE = ...

Supported SKU types.

readonly

Methods

Static addCustomerInfoUpdateListener

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

  • 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

    • 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<boolean>

    promise with boolean response. True if billing is supported, false otherwise.

Static checkTrialOrIntroductoryPriceEligibility

  • checkTrialOrIntroductoryPriceEligibility(productIdentifiers: string[]): Promise<{}>
  • 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

    Returns Promise<{}>

    A map of IntroEligility per productId. The promise will be rejected if configure has not been called yet or if there's in an error checking eligibility.

Static collectDeviceIdentifiers

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

    Returns Promise<void>

    The promise will be rejected if configure has not been called yet or if there's an error setting collecting the device identifiers.

Static configure

Static enableAdServicesAttributionTokenCollection

  • enableAdServicesAttributionTokenCollection(): Promise<void>
  • Enable automatic collection of Apple Search Ad attribution on iOS. Disabled by default

    Returns Promise<void>

    The promise will be rejected if configure has not been called yet.

Static getAppUserID

  • getAppUserID(): Promise<string>
  • Get the appUserID

    Returns Promise<string>

    The app user id in a promise

Static getCustomerInfo

  • Gets current customer info

    Returns Promise<CustomerInfo>

    A promise of a customer info object. Rejections return an error code, and an userInfo object with more information. The promise will be rejected if configure has not been called yet or if there's an issue getting the customer information.

Static getOfferings

  • Gets the map of entitlements -> offerings -> products

    Returns Promise<PurchasesOfferings>

    Promise of entitlements structure. The promise will be rejected if configure has not been called yet.

Static getProducts

  • Fetch the product info

    Parameters

    • productIdentifiers: string[]

      Array of product identifiers

    • type: PURCHASE_TYPE = ...

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

    Returns Promise<PurchasesStoreProduct[]>

    A promise containing an array of products. The promise will be rejected if the products are not properly configured in RevenueCat or if there is another error retrieving them. Rejections return an error code, and a userInfo object with more information. The promise will also be rejected if configure has not been called yet.

Static getPromotionalOffer

  • iOS only. Use this function to retrieve the PurchasesPromotionalOffer for a given PurchasesPackage.

    Parameters

    Returns Promise<undefined | PurchasesPromotionalOffer>

    Returns when the PurchasesPaymentDiscount is returned. Null is returned for Android and incompatible iOS versions. The promise will be rejected if configure has not been called yet or if there's an error getting the payment discount.

Static 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 of the app, like if a promotional subscription is granted through the RevenueCat dashboard.

    Returns Promise<void>

    The promise will be rejected if configure has not been called yet or there's an error invalidating the customer info cache.

Static isAnonymous

  • isAnonymous(): Promise<boolean>
  • Returns Promise<boolean>

    If the appUserID has been generated by RevenueCat or not.

Static isConfigured

  • isConfigured(): Promise<boolean>
  • Check if configure has finished and Purchases has been configured.

    Returns Promise<boolean>

    promise with boolean response

Static logIn

  • 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

    Returns Promise<LogInResult>

    A promise of 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. The promise will be rejected if configure has not been called yet or if there's an issue logging in.

Static logOut

  • 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>

    A promise of a customer info object. Rejections return an error code, and a userInfo object with more information. The promise will be rejected if configure has not been called yet or if there's an issue logging out.

Static presentCodeRedemptionSheet

  • presentCodeRedemptionSheet(): Promise<void>

Static purchaseDiscountedPackage

  • iOS only. Purchase a package applying a given discount.

    Parameters

    • aPackage: PurchasesPackage

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

    • discount: PurchasesPromotionalOffer

      Discount to apply to this package. Retrieve this discount using getPromotionalOffer.

    Returns Promise<MakePurchaseResult>

    } A promise of an object containing a customer info object and a product identifier. Rejections return an error code, a boolean indicating if the user cancelled the purchase, and an object with more information. The promise will be also be rejected if configure has not been called yet.

Static purchaseDiscountedProduct

  • iOS only. Purchase a product applying a given discount.

    Parameters

    Returns Promise<MakePurchaseResult>

    } A promise of an object containing a customer info object and a product identifier. Rejections return an error code, a boolean indicating if the user cancelled the purchase, and an object with more information. The promise will be rejected if configure has not been called yet.

Static purchasePackage

  • Make a purchase

    Parameters

    • aPackage: PurchasesPackage

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

    • Optional upgradeInfo: null | UpgradeInfo

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

    Returns Promise<MakePurchaseResult>

    } A promise of an object containing a customer info object and a product identifier. Rejections return an error code, a boolean indicating if the user cancelled the purchase, and an object with more information. The promise will be also be rejected if configure has not been called yet.

Static purchaseProduct

  • Make a purchase

    Parameters

    • productIdentifier: string

      The product identifier of the product you want to purchase

    • 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 Promise<MakePurchaseResult>

    } A promise of an object containing a customer info object and a product identifier. Rejections return an error code, a boolean indicating if the user cancelled the purchase, and an object with more information. The promise will also be rejected if configure has not been called yet.

Static removeCustomerInfoUpdateListener

  • Removes a given CustomerInfoUpdateListener

    Parameters

    Returns boolean

    True if listener was removed, false otherwise

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.

    Returns Promise<CustomerInfo>

    A promise of a customer info object. Rejections return an error code, and an userInfo object with more information. The promise will be also be rejected if configure has not been called yet.

Static setAd

  • setAd(ad: null | string): Promise<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 Promise<void>

    The promise will be rejected if configure has not been called yet or if there's an error setting the ad subscriber attribute.

Static setAdGroup

  • setAdGroup(adGroup: null | string): Promise<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 Promise<void>

    The promise will be rejected if configure has not been called yet or if there's an error setting ad group.

Static setAdjustID

  • setAdjustID(adjustID: null | string): Promise<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 Promise<void>

    The promise will be rejected if configure has not been called yet or if there's an error setting Adjust ID.

Static setAirshipChannelID

  • setAirshipChannelID(airshipChannelID: null | string): Promise<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 Promise<void>

    The promise will be rejected if configure has not been called yet or if there's an error setting the Airship Channel ID.

Static setAllowSharingStoreAccount

  • setAllowSharingStoreAccount(allowSharing: boolean): Promise<void>
  • deprecated,

    configure behavior through the RevenueCat dashboard instead. If an user tries to purchase a product that is active on the current app store account, we will treat it as a restore and alias the new ID with the previous id.

    Parameters

    • allowSharing: boolean

      Set this to true if you are passing in an appUserID but it is anonymous, this is true by default if you didn't pass an appUserID

    Returns Promise<void>

    The promise will be rejected if configure has not been called yet.

Static setAppsflyerID

  • setAppsflyerID(appsflyerID: null | string): Promise<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 Promise<void>

    The promise will be rejected if configure has not been called yet or if there's an error setting the Appsflyer ID.

Static setAttributes

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

    Parameters

    • attributes: {}

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

      • [key: string]: string | null

    Returns Promise<void>

    The promise will be rejected if configure has not been called yet or there's an error setting the subscriber attributes.

Static setAutomaticAppleSearchAdsAttributionCollection

  • setAutomaticAppleSearchAdsAttributionCollection(enabled: boolean): Promise<void>
  • deprecated,

    use enableAdServicesAttributionTokenCollection instead. Enable automatic collection of Apple Search Ad attribution. Disabled by default

    Parameters

    • enabled: boolean

      Enable or not automatic apple search ads attribution collection

    Returns Promise<void>

    The promise will be rejected if configure has not been called yet.

Static setCampaign

  • setCampaign(campaign: null | string): Promise<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 Promise<void>

    The promise will be rejected if configure has not been called yet or if there's an error setting the campaign.

Static setCreative

  • setCreative(creative: null | string): Promise<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 Promise<void>

    The promise will be rejected if configure has not been called yet or if there's an error setting the creative subscriber attribute.

Static setDebugLogsEnabled

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

    Parameters

    • enabled: boolean

      Enable or not debug logs

    Returns Promise<void>

Static setDisplayName

  • setDisplayName(displayName: null | string): Promise<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 Promise<void>

    The promise will be rejected if configure has not been called yet or if there's an error setting the display name.

Static setEmail

  • setEmail(email: null | string): Promise<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 Promise<void>

    The promise will be rejected if configure has not been called yet or if there's an error setting the email.

Static setFBAnonymousID

  • setFBAnonymousID(fbAnonymousID: null | string): Promise<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 Promise<void>

    The promise will be rejected if configure has not been called yet or if there's an error setting the Facebook Anonymous ID.

Static setFinishTransactions

  • setFinishTransactions(finishTransactions: boolean): Promise<void>
  • Parameters

    • finishTransactions: boolean

      Set finishTransactions to false if you aren't using Purchases SDK to make the purchase

    Returns Promise<void>

    The promise will be rejected if configure has not been called yet.

Static setKeyword

  • setKeyword(keyword: null | string): Promise<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 Promise<void>

    The promise will be rejected if configure has not been called yet or if there's an error setting the keyword.

Static setMediaSource

  • setMediaSource(mediaSource: null | string): Promise<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 Promise<void>

    The promise will be rejected if configure has not been called yet or if there's an error setting the media source.

Static setMparticleID

  • setMparticleID(mparticleID: null | string): Promise<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 Promise<void>

    The promise will be rejected if configure has not been called yet or if there's an error setting the Mparticle ID.

Static setOnesignalID

  • setOnesignalID(onesignalID: null | string): Promise<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 Promise<void>

    The promise will be rejected if configure has not been called yet or if there's an error setting the Onesignal ID.

Static setPhoneNumber

  • setPhoneNumber(phoneNumber: null | string): Promise<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 Promise<void>

    The promise will be rejected if configure has not been called yet or if there's an error setting the phone number.

Static setProxyURL

  • setProxyURL(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.

    Parameters

    • url: string

    Returns Promise<void>

    The promise will be rejected if configure has not been called yet or if there's an error setting the proxy url.

Static setPushToken

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

    Parameters

    • pushToken: null | string

      null will delete the subscriber attribute.

    Returns Promise<void>

    The promise will be rejected if configure has not been called yet or if there's an error setting the push token.

Static setSimulatesAskToBuyInSandbox

  • setSimulatesAskToBuyInSandbox(simulatesAskToBuyInSandbox: boolean): Promise<void>
  • iOS only.

    Parameters

    • 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

    Returns Promise<void>

    The promise will be rejected if configure has not been called yet.

Static 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.

    warning

    This function should only be called if you're not calling purchaseProduct/purchasePackage.

    Returns Promise<void>

    The promise will be rejected if configure has not been called yet or if there's an error syncing purchases.

Generated using TypeDoc