https://github.com/RevenueCat/purchases-capacitor
Capacitor in-app purchases and subscriptions made easy.
https://github.com/RevenueCat/purchases-capacitor
android capacitor capacitor-plugin ios
Last synced: about 1 year ago
JSON representation
Capacitor in-app purchases and subscriptions made easy.
- Host: GitHub
- URL: https://github.com/RevenueCat/purchases-capacitor
- Owner: RevenueCat
- License: mit
- Created: 2021-11-13T22:01:24.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-05-07T18:00:44.000Z (about 1 year ago)
- Last Synced: 2025-05-10T15:50:21.423Z (about 1 year ago)
- Topics: android, capacitor, capacitor-plugin, ios
- Language: TypeScript
- Homepage:
- Size: 19 MB
- Stars: 182
- Watchers: 14
- Forks: 19
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.latest.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-capacitorjs - @revenuecat/purchases-capacitor - Capacitor in-app purchases and subscriptions made easy with RevenueCat. (Plugins / Community Plugins)
- awesome-capacitor - Purchases - Capacitor in-app purchases and subscriptions made easy with RevenueCat. (Other plugins / Specialized Hardware)
README
😻 In-App Subscriptions Made Easy 😻
[](https://github.com/RevenueCat/purchases-capacitor/blob/main/LICENSE)
[](https://github.com/RevenueCat/purchases-capacitor/releases)
RevenueCat is a powerful, reliable, and free to use in-app purchase server with cross-platform support. Our open-source framework provides a backend and a wrapper around StoreKit and Google Play Billing to make implementing in-app purchases and subscriptions easy.
Whether you are building a new app or already have millions of customers, you can use RevenueCat to:
* Fetch products, make purchases, and check subscription status with our [native SDKs](https://docs.revenuecat.com/docs/installation).
* Host and [configure products](https://docs.revenuecat.com/docs/entitlements) remotely from our dashboard.
* Analyze the most important metrics for your app business [in one place](https://docs.revenuecat.com/docs/charts).
* See customer transaction histories, chart lifetime value, and [grant promotional subscriptions](https://docs.revenuecat.com/docs/customers).
* Get notified of real-time events through [webhooks](https://docs.revenuecat.com/docs/webhooks).
* Send enriched purchase events to analytics and attribution tools with our easy integrations.
Sign up to [get started for free](https://app.revenuecat.com/signup).
## @revenuecat/purchases-capacitor
*@revenuecat/purchases-capacitor* is the client for the [RevenueCat](https://www.revenuecat.com/) subscription and purchase tracking system. It is an open source framework that provides a wrapper around StoreKit, Google Play Billing and the RevenueCat backend to make implementing in-app purchases in Capacitor easy.
## RevenueCat SDK Features
| | RevenueCat |
|----|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ✅ | Server-side receipt validation |
| ➡️ | [Webhooks](https://docs.revenuecat.com/docs/webhooks) - enhanced server-to-server communication with events for purchases, renewals, cancellations, and more |
| 🎯 | Subscription status tracking - know whether a user is subscribed whether they're on iOS, Android or web |
| 📊 | Analytics - automatic calculation of metrics like conversion, mrr, and churn |
| 📝 | [Online documentation](https://docs.revenuecat.com/docs) up to date |
| 🔀 | [Integrations](https://www.revenuecat.com/integrations) - over a dozen integrations to easily send purchase data where you need it |
| 💯 | Well maintained - [frequent releases](https://github.com/RevenueCat/purchases-capacitor/releases) |
| 📮 | Great support - [Help Center](https://revenuecat.zendesk.com) |
## Getting Started
For more detailed information, you can view our complete documentation at [docs.revenuecat.com](https://docs.revenuecat.com/docs).
Please follow the [Quickstart Guide](https://docs.revenuecat.com/docs/) for more information on how to install the SDK.
```bash
npm install @revenuecat/purchases-capacitor
npx cap sync
```
## Contributing
Contributions are always welcome! To learn how you can contribute, please see the [Contributing Guide](./CONTRIBUTING.md).
## Acknowledgment
This plugin is based on [CapGo's Capacitor plugin](https://www.npmjs.com/package/@capgo/capacitor-purchases). The plugin was transferred to RevenueCat to become an officially supported plugin.
## API
* [`configure(...)`](#configure)
* [`parseAsWebPurchaseRedemption(...)`](#parseaswebpurchaseredemption)
* [`redeemWebPurchase(...)`](#redeemwebpurchase)
* [`setMockWebResults(...)`](#setmockwebresults)
* [`setSimulatesAskToBuyInSandbox(...)`](#setsimulatesasktobuyinsandbox)
* [`addCustomerInfoUpdateListener(...)`](#addcustomerinfoupdatelistener)
* [`removeCustomerInfoUpdateListener(...)`](#removecustomerinfoupdatelistener)
* [`getOfferings()`](#getofferings)
* [`getCurrentOfferingForPlacement(...)`](#getcurrentofferingforplacement)
* [`syncAttributesAndOfferingsIfNeeded()`](#syncattributesandofferingsifneeded)
* [`getProducts(...)`](#getproducts)
* [`purchaseStoreProduct(...)`](#purchasestoreproduct)
* [`purchaseDiscountedProduct(...)`](#purchasediscountedproduct)
* [`purchasePackage(...)`](#purchasepackage)
* [`purchaseSubscriptionOption(...)`](#purchasesubscriptionoption)
* [`purchaseDiscountedPackage(...)`](#purchasediscountedpackage)
* [`restorePurchases()`](#restorepurchases)
* [`recordPurchase(...)`](#recordpurchase)
* [`getAppUserID()`](#getappuserid)
* [`logIn(...)`](#login)
* [`logOut()`](#logout)
* [`setLogLevel(...)`](#setloglevel)
* [`setLogHandler(...)`](#setloghandler)
* [`getCustomerInfo()`](#getcustomerinfo)
* [`syncPurchases()`](#syncpurchases)
* [`syncObserverModeAmazonPurchase(...)`](#syncobservermodeamazonpurchase)
* [`syncAmazonPurchase(...)`](#syncamazonpurchase)
* [`enableAdServicesAttributionTokenCollection()`](#enableadservicesattributiontokencollection)
* [`isAnonymous()`](#isanonymous)
* [`checkTrialOrIntroductoryPriceEligibility(...)`](#checktrialorintroductorypriceeligibility)
* [`getPromotionalOffer(...)`](#getpromotionaloffer)
* [`getEligibleWinBackOffersForProduct(...)`](#geteligiblewinbackoffersforproduct)
* [`getEligibleWinBackOffersForPackage(...)`](#geteligiblewinbackoffersforpackage)
* [`purchaseProductWithWinBackOffer(...)`](#purchaseproductwithwinbackoffer)
* [`purchasePackageWithWinBackOffer(...)`](#purchasepackagewithwinbackoffer)
* [`invalidateCustomerInfoCache()`](#invalidatecustomerinfocache)
* [`presentCodeRedemptionSheet()`](#presentcoderedemptionsheet)
* [`setAttributes(...)`](#setattributes)
* [`setEmail(...)`](#setemail)
* [`setPhoneNumber(...)`](#setphonenumber)
* [`setDisplayName(...)`](#setdisplayname)
* [`setPushToken(...)`](#setpushtoken)
* [`setProxyURL(...)`](#setproxyurl)
* [`collectDeviceIdentifiers()`](#collectdeviceidentifiers)
* [`setAdjustID(...)`](#setadjustid)
* [`setAppsflyerID(...)`](#setappsflyerid)
* [`setFBAnonymousID(...)`](#setfbanonymousid)
* [`setMparticleID(...)`](#setmparticleid)
* [`setCleverTapID(...)`](#setclevertapid)
* [`setMixpanelDistinctID(...)`](#setmixpaneldistinctid)
* [`setFirebaseAppInstanceID(...)`](#setfirebaseappinstanceid)
* [`setOnesignalID(...)`](#setonesignalid)
* [`setOnesignalUserID(...)`](#setonesignaluserid)
* [`setAirshipChannelID(...)`](#setairshipchannelid)
* [`setMediaSource(...)`](#setmediasource)
* [`setCampaign(...)`](#setcampaign)
* [`setAdGroup(...)`](#setadgroup)
* [`setAd(...)`](#setad)
* [`setKeyword(...)`](#setkeyword)
* [`setCreative(...)`](#setcreative)
* [`canMakePayments(...)`](#canmakepayments)
* [`beginRefundRequestForActiveEntitlement()`](#beginrefundrequestforactiveentitlement)
* [`beginRefundRequestForEntitlement(...)`](#beginrefundrequestforentitlement)
* [`beginRefundRequestForProduct(...)`](#beginrefundrequestforproduct)
* [`showInAppMessages(...)`](#showinappmessages)
* [`isConfigured()`](#isconfigured)
* [Interfaces](#interfaces)
* [Type Aliases](#type-aliases)
* [Enums](#enums)
### configure(...)
```typescript
configure(configuration: PurchasesConfiguration) => Promise
```
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} |
--------------------
### parseAsWebPurchaseRedemption(...)
```typescript
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(...)
```typescript
redeemWebPurchase(options: { webPurchaseRedemption: WebPurchaseRedemption; }) => Promise
```
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(...)
```typescript
setMockWebResults(options: { shouldMockWebResults: boolean; }) => Promise
```
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(...)
```typescript
setSimulatesAskToBuyInSandbox(options: { simulatesAskToBuyInSandbox: boolean; }) => Promise
```
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(...)
```typescript
addCustomerInfoUpdateListener(customerInfoUpdateListener: CustomerInfoUpdateListener) => Promise
```
Sets a function to be called on updated customer info
| Param | Type | Description |
| -------------------------------- | --------------------------------------------------------------------------------- | -------------------------------------------------------- |
| **`customerInfoUpdateListener`** | CustomerInfoUpdateListener | CustomerInfo update listener |
**Returns:** Promise<string>
--------------------
### removeCustomerInfoUpdateListener(...)
```typescript
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()
```typescript
getOfferings() => Promise
```
Gets the map of entitlements -> offerings -> products
**Returns:** Promise<PurchasesOfferings>
--------------------
### getCurrentOfferingForPlacement(...)
```typescript
getCurrentOfferingForPlacement(options: { placementIdentifier: string; }) => Promise
```
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()
```typescript
syncAttributesAndOfferingsIfNeeded() => Promise
```
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(...)
```typescript
getProducts(options: GetProductOptions) => Promise<{ products: PurchasesStoreProduct[]; }>
```
Fetch the product info
| Param | Type |
| ------------- | --------------------------------------------------------------- |
| **`options`** | GetProductOptions |
**Returns:** Promise<{ products: PurchasesStoreProduct[]; }>
--------------------
### purchaseStoreProduct(...)
```typescript
purchaseStoreProduct(options: PurchaseStoreProductOptions) => Promise
```
Make a purchase
| Param | Type |
| ------------- | ----------------------------------------------------------------------------------- |
| **`options`** | PurchaseStoreProductOptions |
**Returns:** Promise<MakePurchaseResult>
--------------------
### purchaseDiscountedProduct(...)
```typescript
purchaseDiscountedProduct(options: PurchaseDiscountedProductOptions) => Promise
```
iOS only. Purchase a product applying a given discount.
| Param | Type |
| ------------- | --------------------------------------------------------------------------------------------- |
| **`options`** | PurchaseDiscountedProductOptions |
**Returns:** Promise<MakePurchaseResult>
--------------------
### purchasePackage(...)
```typescript
purchasePackage(options: PurchasePackageOptions) => Promise
```
Make a purchase
| Param | Type |
| ------------- | ------------------------------------------------------------------------- |
| **`options`** | PurchasePackageOptions |
**Returns:** Promise<MakePurchaseResult>
--------------------
### purchaseSubscriptionOption(...)
```typescript
purchaseSubscriptionOption(options: PurchaseSubscriptionOptionOptions) => Promise
```
Google only. Make a purchase of a subscriptionOption
| Param | Type |
| ------------- | ----------------------------------------------------------------------------------------------- |
| **`options`** | PurchaseSubscriptionOptionOptions |
**Returns:** Promise<MakePurchaseResult>
--------------------
### purchaseDiscountedPackage(...)
```typescript
purchaseDiscountedPackage(options: PurchaseDiscountedPackageOptions) => Promise
```
iOS only. Purchase a package applying a given discount.
| Param | Type |
| ------------- | --------------------------------------------------------------------------------------------- |
| **`options`** | PurchaseDiscountedPackageOptions |
**Returns:** Promise<MakePurchaseResult>
--------------------
### restorePurchases()
```typescript
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(...)
```typescript
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()
```typescript
getAppUserID() => Promise<{ appUserID: string; }>
```
Get the appUserID
**Returns:** Promise<{ appUserID: string; }>
--------------------
### logIn(...)
```typescript
logIn(options: { appUserID: string; }) => Promise
```
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()
```typescript
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(...)
```typescript
setLogLevel(options: { level: LOG_LEVEL; }) => Promise
```
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(...)
```typescript
setLogHandler(logHandler: LogHandler) => Promise
```
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()
```typescript
getCustomerInfo() => Promise<{ customerInfo: CustomerInfo; }>
```
Gets current customer info
**Returns:** Promise<{ customerInfo: CustomerInfo; }>
--------------------
### syncPurchases()
```typescript
syncPurchases() => Promise
```
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(...)
```typescript
syncObserverModeAmazonPurchase(options: SyncObserverModeAmazonPurchaseOptions) => Promise
```
| Param | Type |
| ------------- | ------------------------------------------------------------------------------- |
| **`options`** | SyncAmazonPurchaseOptions |
--------------------
### syncAmazonPurchase(...)
```typescript
syncAmazonPurchase(options: SyncAmazonPurchaseOptions) => Promise
```
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.
| Param | Type |
| ------------- | ------------------------------------------------------------------------------- |
| **`options`** | SyncAmazonPurchaseOptions |
--------------------
### enableAdServicesAttributionTokenCollection()
```typescript
enableAdServicesAttributionTokenCollection() => Promise
```
Enable automatic collection of Apple Search Ad attribution on iOS. Disabled by default. Supported in iOS 14.3+ only
--------------------
### isAnonymous()
```typescript
isAnonymous() => Promise<{ isAnonymous: boolean; }>
```
**Returns:** Promise<{ isAnonymous: boolean; }>
--------------------
### checkTrialOrIntroductoryPriceEligibility(...)
```typescript
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(...)
```typescript
getPromotionalOffer(options: GetPromotionalOfferOptions) => Promise
```
iOS only. Use this function to retrieve the `PurchasesPromotionalOffer` for a given `PurchasesPackage`.
| Param | Type |
| ------------- | --------------------------------------------------------------------------------- |
| **`options`** | GetPromotionalOfferOptions |
**Returns:** Promise<PurchasesPromotionalOffer>
--------------------
### getEligibleWinBackOffersForProduct(...)
```typescript
getEligibleWinBackOffersForProduct(options: GetEligibleWinBackOffersForProductOptions) => Promise<{ eligibleWinBackOffers: PurchasesWinBackOffer[]; }>
```
iOS only, requires iOS 18.0 or greater with StoreKit 2. Use this function to retrieve
the eligible `PurchasesWinBackOffer`s that a subscriber is eligible for for a
given `PurchasesStoreProduct`.
| Param | Type |
| ------------- | --------------------------------------------------------------------------------------------------------------- |
| **`options`** | GetEligibleWinBackOffersForProductOptions |
**Returns:** Promise<{ eligibleWinBackOffers: PurchasesWinBackOffer[]; }>
--------------------
### getEligibleWinBackOffersForPackage(...)
```typescript
getEligibleWinBackOffersForPackage(options: GetEligibleWinBackOffersForPackageOptions) => Promise<{ eligibleWinBackOffers: PurchasesWinBackOffer[]; }>
```
iOS only, requires iOS 18.0 or greater with StoreKit 2. Use this function to retrieve
the eligible `PurchasesWinBackOffer`s that a subscriber is eligible for for a
given `PurchasesStorePackage`.
| Param | Type |
| ------------- | --------------------------------------------------------------------------------------------------------------- |
| **`options`** | GetEligibleWinBackOffersForPackageOptions |
**Returns:** Promise<{ eligibleWinBackOffers: PurchasesWinBackOffer[]; }>
--------------------
### purchaseProductWithWinBackOffer(...)
```typescript
purchaseProductWithWinBackOffer(options: PurchaseProductWithWinBackOfferOptions) => Promise
```
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(...)
```typescript
purchasePackageWithWinBackOffer(options: PurchasePackageWithWinBackOfferOptions) => Promise
```
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()
```typescript
invalidateCustomerInfoCache() => Promise
```
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()
```typescript
presentCodeRedemptionSheet() => Promise
```
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(...)
```typescript
setAttributes(attributes: { [key: string]: string | null; }) => Promise
```
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(...)
```typescript
setEmail(options: { email: string | null; }) => Promise
```
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(...)
```typescript
setPhoneNumber(options: { phoneNumber: string | null; }) => Promise
```
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(...)
```typescript
setDisplayName(options: { displayName: string | null; }) => Promise
```
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(...)
```typescript
setPushToken(options: { pushToken: string | null; }) => Promise
```
Subscriber attribute associated with the push token for the user
| Param | Type | Description |
| ------------- | ------------------------------------------- | ------------------------------------------ |
| **`options`** | { pushToken: string \| null; } | null will delete the subscriber attribute. |
--------------------
### setProxyURL(...)
```typescript
setProxyURL(options: { url: string; }) => Promise
```
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()
```typescript
collectDeviceIdentifiers() => Promise
```
Automatically collect subscriber attributes associated with the device identifiers.
$idfa, $idfv, $ip on iOS
$gpsAdId, $androidId, $ip on Android
--------------------
### setAdjustID(...)
```typescript
setAdjustID(options: { adjustID: string | null; }) => Promise
```
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(...)
```typescript
setAppsflyerID(options: { appsflyerID: string | null; }) => Promise
```
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(...)
```typescript
setFBAnonymousID(options: { fbAnonymousID: string | null; }) => Promise
```
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(...)
```typescript
setMparticleID(options: { mparticleID: string | null; }) => Promise
```
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(...)
```typescript
setCleverTapID(options: { cleverTapID: string | null; }) => Promise
```
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(...)
```typescript
setMixpanelDistinctID(options: { mixpanelDistinctID: string | null; }) => Promise
```
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(...)
```typescript
setFirebaseAppInstanceID(options: { firebaseAppInstanceID: string | null; }) => Promise
```
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(...)
```typescript
setOnesignalID(options: { onesignalID: string | null; }) => Promise
```
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(...)
```typescript
setOnesignalUserID(options: { onesignalUserID: string | null; }) => Promise
```
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. |
--------------------
### setAirshipChannelID(...)
```typescript
setAirshipChannelID(options: { airshipChannelID: string | null; }) => Promise
```
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(...)
```typescript
setMediaSource(options: { mediaSource: string | null; }) => Promise
```
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(...)
```typescript
setCampaign(options: { campaign: string | null; }) => Promise
```
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(...)
```typescript
setAdGroup(options: { adGroup: string | null; }) => Promise
```
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(...)
```typescript
setAd(options: { ad: string | null; }) => Promise
```
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(...)
```typescript
setKeyword(options: { keyword: string | null; }) => Promise
```
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(...)
```typescript
setCreative(options: { creative: string | null; }) => Promise
```
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(...)
```typescript
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()
```typescript
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(...)
```typescript
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(...)
```typescript
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(...)
```typescript
showInAppMessages(options?: { messageTypes?: IN_APP_MESSAGE_TYPE[] | undefined; } | undefined) => Promise
```
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()
```typescript
isConfigured() => Promise<{ isConfigured: boolean; }>
```
Check if configure has finished and Purchases has been configured.
**Returns:** Promise<{ isConfigured: boolean; }>
--------------------
### Interfaces
#### PurchasesConfiguration
Holds parameters to initialize the SDK.
| Prop | Type | Description |
| ----------------------------------------------- | --------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`apiKey`** | string | RevenueCat API Key. Needs to be a string |
| **`appUserID`** | string \| null | A unique id for identifying the user |
| **`purchasesAreCompletedBy`** | PurchasesAreCompletedBy | Set this to MY_APP and provide a STOREKIT_VERSION if you have your own IAP implementation and want to only use RevenueCat's backend. Defaults to PURCHASES_ARE_COMPLETED_BY_TYPE.REVENUECAT. If you are on Android and setting this to MY_APP, will have to acknowledge the purchases yourself. If your app is only on Android, you may specify any StoreKit version, as it is ignored by the Android SDK. |
| **`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. |
| **`storeKitVersion`** | STOREKIT_VERSION | iOS-only, will be ignored for Android. By selecting the DEFAULT value, RevenueCat will automatically select the most appropriate StoreKit version for the app's runtime environment. - Warning: Make sure you have an In-App Purchase Key configured in your app. Please see https://rev.cat/in-app-purchase-key-configuration for more info. - Note: StoreKit 2 is only available on iOS 16+. StoreKit 1 will be used for previous iOS versions regardless of this setting. |
| **`useAmazon`** | boolean | An optional boolean. Android only. Required to configure the plugin to be used in the Amazon Appstore. |
| **`shouldShowInAppMessagesAutomatically`** | boolean | Whether we should show store in-app messages automatically. Both Google Play and the App Store provide in-app messages for some situations like billing issues. By default, those messages will be shown automatically. This allows to disable that behavior, so you can display those messages at your convenience. For more information, check: https://rev.cat/storekit-message and https://rev.cat/googleplayinappmessaging |
| **`entitlementVerificationMode`** | ENTITLEMENT_VERIFICATION_MODE | Verification strictness levels for [EntitlementInfo]. See https://rev.cat/trusted-entitlements for more info. |
| **`pendingTransactionsForPrepaidPlansEnabled`** | boolean | Enable this setting if you want to allow pending purchases for prepaid subscriptions (only supported in Google Play). Note that entitlements are not granted until payment is done. Disabled by default. |
| **`diagnosticsEnabled`** | boolean | Enabling diagnostics will send some performance and debugging information from the SDK to RevenueCat's servers. Examples of this information include response times, cache hits or error codes. No personal identifiable information will be collected. The default value is false. |
#### CustomerInfo
Type containing all information regarding the customer
| Prop | Type | Description |
| -------------------------------------- | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **`entitlements`** | PurchasesEntitlementInfos | Entitlements attached to this customer info |
| **`activeSubscriptions`** | string[] | Set of active subscription skus |
| **`allPurchasedProductIdentifiers`** | string[] | Set of purchased skus, active and inactive |
| **`latestExpirationDate`** | string \| null | The latest expiration date of all purchased skus |
| **`firstSeen`** | string | The date this user was first seen in RevenueCat. |
| **`originalAppUserId`** | string | The original App User Id recorded for this user. |
| **`requestDate`** | string | Date when this info was requested |
| **`allExpirationDates`** | { [key: string]: string \| null; } | Map of skus to expiration dates |
| **`allPurchaseDates`** | { [key: string]: string \| null; } | Map of skus to purchase dates |
| **`originalApplicationVersion`** | string \| null | Returns the version number for the version of the application when the user bought the app. Use this for grandfathering users when migrating to subscriptions. This corresponds to the value of CFBundleVersion (in iOS) in the Info.plist file when the purchase was originally made. This is always null in Android |
| **`originalPurchaseDate`** | string \| null | Returns the purchase date for the version of the application when the user bought the app. Use this for grandfathering users when migrating to subscriptions. |
| **`managementURL`** | string \| null | URL to manage the active subscription of the user. If this user has an active iOS subscription, this will point to the App Store, if the user has an active Play Store subscription it will point there. If there are no active subscriptions it will be null. If there are multiple for different platforms, it will point to the device store. |
| **`nonSubscriptionTransactions`** | PurchasesStoreTransaction[] | List of all non subscription transactions. Use this to fetch the history of non-subscription purchases |
| **`subscriptionsByProductIdentifier`** | { [key: string]: PurchasesSubscriptionInfo; } | Information about the customer's subscriptions for each product identifier. |
#### PurchasesEntitlementInfos
Contains all the entitlements associated to the user.
| Prop | Type | Description |
| ------------------ | ------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`all`** | { [key: string]: PurchasesEntitlementInfo; } | Map of all EntitlementInfo (`PurchasesEntitlementInfo`) objects (active and inactive) keyed by entitlement identifier. |
| **`active`** | { [key: string]: PurchasesEntitlementInfo; } | Map of active EntitlementInfo (`PurchasesEntitlementInfo`) objects keyed by entitlement identifier. |
| **`verification`** | VERIFICATION_RESULT | If entitlement verification was enabled, the result of that verification. If not, VerificationResult.NOT_REQUESTED |
#### PurchasesEntitlementInfo
The EntitlementInfo object gives you access to all of the information about the status of a user entitlement.
| Prop | Type | Description |
| ---------------------------------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`identifier`** | string | The entitlement identifier configured in the RevenueCat dashboard |
| **`isActive`** | boolean | True if the user has access to this entitlement |
| **`willRenew`** | boolean | True if the underlying subscription is set to renew at the end of the billing period (expirationDate). |
| **`periodType`** | string | The last period type this entitlement was in. Either: NORMAL, INTRO, TRIAL, PREPAID. |
| **`latestPurchaseDate`** | string | The latest purchase or renewal date for the entitlement in ISO8601 format. |
| **`latestPurchaseDateMillis`** | number | The latest purchase or renewal date for the entitlement in milliseconds. |
| **`originalPurchaseDate`** | string | The first date this entitlement was purchased in ISO8601 format. |
| **`originalPurchaseDateMillis`** | number | The first date this entitlement was purchased in milliseconds. |
| **`expirationDate`** | string \| null | The expiration date for the entitlement in ISO8601, can be `null` for lifetime access. If the `periodType` is `trial`, this is the trial expiration date. |
| **`expirationDateMillis`** | number \| null | The expiration date for the entitlement in milliseconds, can be `null` for lifetime access. If the `periodType` is `trial`, this is the trial expiration date. |
| **`store`** | Store | The store where this entitlement was unlocked from. |
| **`productIdentifier`** | string | The product identifier that unlocked this entitlement |
| **`productPlanIdentifier`** | string \| null | The product plan identifier that unlocked this entitlement. Android subscriptions only, null on consumables and iOS. |
| **`isSandbox`** | boolean | False if this entitlement is unlocked via a production purchase |
| **`unsubscribeDetectedAt`** | string \| null | The date an unsubscribe was detected in ISO8601 format. Can be `null`. Entitlement may still be active even if user has unsubscribed. Check the `isActive` property. |
| **`unsubscribeDetectedAtMillis`** | number \| null | The date an unsubscribe was detected in milliseconds. Can be `null`. Entitlement may still be active even if user has unsubscribed. Check the `isActive` property. |
| **`billingIssueDetectedAt`** | string \| null | The date a billing issue was detected in ISO8601 format. Can be `null` if there is no billing issue or an issue has been resolved Entitlement may still be active even if there is a billing issue. Check the `isActive` property. |
| **`billingIssueDetectedAtMillis`** | number \| null | The date a billing issue was detected in milliseconds. Can be `null` if there is no billing issue or an issue has been resolved Entitlement may still be active even if there is a billing issue. Check the `isActive` property. |
| **`ownershipType`** | OwnershipType | Supported ownership types for an entitlement. PURCHASED if the purchase was made directly by this user. FAMILY_SHARED if the purchase has been shared to this user by a family member. UNKNOWN if the purchase has no or an unknown ownership type. |
| **`verification`** | VERIFICATION_RESULT | If entitlement verification was enabled, the result of that verification. If not, VerificationResult.NOT_REQUESTED |
#### PurchasesStoreTransaction
Represents a non-subscription transaction in the Store.
| Prop | Type | Description |
| --------------------------- | ------------------- | ---------------------------------------------------- |
| **`transactionIdentifier`** | string | Id of the transaction. |
| **`productIdentifier`** | string | Product Id associated with the transaction. |
| **`purchaseDate`** | string | Purchase date of the transaction in ISO 8601 format. |
#### PurchasesSubscriptionInfo
Subscription purchases of the Customer.
| Prop | Type | Description |
| ----------------------------- | ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`productIdentifier`** | string | The product identifier. |
| **`purchaseDate`** | string | Date when the last subscription period started. |
| **`originalPurchaseDate`** | string \| null | Date when this subscription first started. This property does not update with renewals. This property also does not update for product changes within a subscription group or re-subscriptions by lapsed subscribers. |
| **`expiresDate`** | string \| null | Date when the subscription expires/expired |
| **`store`** | Store | Store where the subscription was purchased. |
| **`unsubscribeDetectedAt`** | string \| null | Date when RevenueCat detected that auto-renewal was turned off for this subscription. Note the subscription may still be active, check the `expiresDate` attribute. |
| **`isSandbox`** | boolean | Whether or not the purchase was made in sandbox mode. |
| **`billingIssuesDetectedAt`** | string \| null | Date when RevenueCat detected any billing issues with this subscription. If and when the billing issue gets resolved, this field is set to nil. |
| **`gracePeriodExpiresDate`** | string \| null | Date when any grace period for this subscription expires/expired. nil if the customer has never been in a grace period. |
| **`ownershipType`** | OwnershipType | How the Customer received access to this subscription: - [OwnershipType.PURCHASED]: The customer bought the subscription. - [OwnershipType.FAMILY_SHARED]: The Customer has access to the product via their family. |
| **`periodType`** | PeriodType | Type of the current subscription period: - [PeriodType.NORMAL]: The product is in a normal period (default) - [PeriodType.TRIAL]: The product is in a free trial period - [PeriodType.INTRO]: The product is in an introductory pricing period - [PeriodType.PREPAID]: The product is in a prepaid pricing period |
| **`refundedAt`** | string \| null | Date when RevenueCat detected a refund of this subscription. |
| **`storeTransactionId`** | string \| null | The transaction id in the store of the subscription. |
| **`isActive`** | boolean | Whether the subscription is currently active. |
| **`willRenew`** | boolean | Whether the subscription will renew at the next billing period. |
#### PurchasesError
Type encapsulating an error in an SDK operation.
| Prop | Type |
| ---------------------------- | --------------------------------------------------------------------- |
| **`code`** | PURCHASES_ERROR_CODE |
| **`message`** | string |
| **`readableErrorCode`** | string |
| **`userInfo`** | ErrorInfo |
| **`underlyingErrorMessage`** | string |
| **`userCancelled`** | boolean \| null |
#### ErrorInfo
Type encapsulating extra info on an error in an SDK operation.
| Prop | Type |
| ----------------------- | ------------------- |
| **`readableErrorCode`** | string |
#### PurchasesOfferings
Contains all the offerings configured in RevenueCat dashboard.
For more info see https://docs.revenuecat.com/docs/entitlements
| Prop | Type | Description |
| ------------- | ----------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| **`all`** | { [key: string]: PurchasesOffering; } | Map of all Offerings [PurchasesOffering] objects keyed by their identifier. |
| **`current`** | PurchasesOffering \| null | Current offering configured in the RevenueCat dashboard. |
#### PurchasesOffering
An offering is a collection of Packages (`PurchasesPackage`) available for the user to purchase.
For more info see https://docs.revenuecat.com/docs/entitlements
| Prop | Type | Description |
| ----------------------- | --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`identifier`** | string | Unique identifier defined in RevenueCat dashboard. |
| **`serverDescription`** | string | Offering description defined in RevenueCat dashboard. |
| **`metadata`** | { [key: string]: unknown; } | Offering metadata defined in RevenueCat dashboard. To access values, you need to check the type beforehand. For example: const my_unknown_value: unknown = offering.metadata['my_key']; const my_string_value: string \| undefined = typeof(my_unknown_value) === 'string' ? my_unknown_value : undefined; |
| **`availablePackages`** | PurchasesPackage[] | Array of `Package` objects available for purchase. |
| **`lifetime`** | PurchasesPackage \| null | Lifetime package type configured in the RevenueCat dashboard, if available. |
| **`annual`** | PurchasesPackage \| null | Annual package type configured in the RevenueCat dashboard, if available. |
| **`sixMonth`** | PurchasesPackage \| null | Six month package type configured in the RevenueCat dashboard, if available. |
| **`threeMonth`** | PurchasesPackage \| null | Three month package type configured in the RevenueCat dashboard, if available. |
| **`twoMonth`** | PurchasesPackage \| null | Two month package type configured in the RevenueCat dashboard, if available. |
| **`monthly`** | PurchasesPackage \| null | Monthly package type configured in the RevenueCat dashboard, if available. |
| **`weekly`** | PurchasesPackage \| null | Weekly package type configured in the RevenueCat dashboard, if available. |
#### PurchasesPackage
Contains information about the product available for the user to purchase.
For more info see https://docs.revenuecat.com/docs/entitlements
| Prop | Type | Description |
| ------------------------------ | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| **`identifier`** | string | Unique identifier for this package. Can be one a predefined package type or a custom one. |
| **`packageType`** | PACKAGE_TYPE | Package type for the product. Will be one of [PACKAGE_TYPE]. |
| **`product`** | PurchasesStoreProduct | Product assigned to this package. |
| **`offeringIdentifier`** | string | Offering this package belongs to. |
| **`presentedOfferingContext`** | PresentedOfferingContext | Offering context this package belongs to. Null if not using offerings or if fetched directly from store via getProducts. |
#### PurchasesStoreProduct
Type representing a product from the Store.
| Prop | Type | Description |
| --------------------------------- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`identifier`** | string | Product Id. |
| **`description`** | string | Description of the product. |
| **`title`** | string | Title of the product. |
| **`price`** | number | Price of the product in the local currency. Contains the price value of defaultOption for Google Play. |
| **`priceString`** | string | Formatted price of the item, including its currency sign. Contains the formatted price value of defaultOption for Google Play.