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:
Sign up to get started for free.
@revenuecat/purchases-capacitor is the client for the RevenueCat 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 | |
|---|---|
| ✅ | Server-side receipt validation |
| ➡️ | 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 up to date |
| 🔀 | Integrations - over a dozen integrations to easily send purchase data where you need it |
| 💯 | Well maintained - frequent releases |
| 📮 | Great support - Help Center |
For more detailed information, you can view our complete documentation at docs.revenuecat.com.
Please follow the Quickstart Guide for more information on how to install the SDK.
npm install @revenuecat/purchases-capacitor
npx cap sync
Contributions are always welcome! To learn how you can contribute, please see the Contributing Guide.
This plugin is based on CapGo's Capacitor plugin. The plugin was transferred to RevenueCat to become an officially supported plugin.
configure(...)getVirtualCurrencies()invalidateVirtualCurrenciesCache()getCachedVirtualCurrencies()parseAsWebPurchaseRedemption(...)redeemWebPurchase(...)setMockWebResults(...)setSimulatesAskToBuyInSandbox(...)addCustomerInfoUpdateListener(...)removeCustomerInfoUpdateListener(...)getOfferings()getCurrentOfferingForPlacement(...)syncAttributesAndOfferingsIfNeeded()getProducts(...)purchaseStoreProduct(...)purchaseDiscountedProduct(...)purchasePackage(...)purchaseSubscriptionOption(...)purchaseDiscountedPackage(...)restorePurchases()recordPurchase(...)getAppUserID()getStorefront()logIn(...)logOut()setLogLevel(...)setLogHandler(...)getCustomerInfo()syncPurchases()syncObserverModeAmazonPurchase(...)syncAmazonPurchase(...)enableAdServicesAttributionTokenCollection()isAnonymous()checkTrialOrIntroductoryPriceEligibility(...)getPromotionalOffer(...)getEligibleWinBackOffersForProduct(...)getEligibleWinBackOffersForPackage(...)purchaseProductWithWinBackOffer(...)purchasePackageWithWinBackOffer(...)invalidateCustomerInfoCache()presentCodeRedemptionSheet()setAttributes(...)setEmail(...)setPhoneNumber(...)setDisplayName(...)setPushToken(...)setProxyURL(...)collectDeviceIdentifiers()setAdjustID(...)setAppsflyerID(...)setFBAnonymousID(...)setMparticleID(...)setCleverTapID(...)setMixpanelDistinctID(...)setFirebaseAppInstanceID(...)setOnesignalID(...)setOnesignalUserID(...)setAirshipChannelID(...)setMediaSource(...)setCampaign(...)setAdGroup(...)setAd(...)setKeyword(...)setCreative(...)canMakePayments(...)beginRefundRequestForActiveEntitlement()beginRefundRequestForEntitlement(...)beginRefundRequestForProduct(...)showInAppMessages(...)isConfigured()overridePreferredUILocale(...)trackCustomPaywallImpression(...)configure(configuration: PurchasesConfiguration) => Promise<void>
Sets up Purchases with your API key and an app user id.
| Param | Type | Description |
|---|---|---|
configuration |
PurchasesConfiguration |
RevenueCat configuration object including the API key and other optional parameters. See {@link PurchasesConfiguration} |
getVirtualCurrencies() => Promise<{ virtualCurrencies: PurchasesVirtualCurrencies; }>
Fetches the virtual currencies for the current subscriber.
Returns: Promise<{ virtualCurrencies: PurchasesVirtualCurrencies; }>
invalidateVirtualCurrenciesCache() => Promise<void>
Invalidates the cache for virtual currencies.
This is useful for cases where a virtual currency's balance might have been updated outside of the app, like if you decreased a user's balance from the user spending a virtual currency, or if you increased the balance from your backend using the server APIs.
getCachedVirtualCurrencies() => Promise<{ cachedVirtualCurrencies: PurchasesVirtualCurrencies | null; }>
The currently cached {@link PurchasesVirtualCurrencies} if one is available. This value will remain null until virtual currencies have been fetched at least once with {@link getVirtualCurrencies} or an equivalent function.
Returns: Promise<{ cachedVirtualCurrencies: PurchasesVirtualCurrencies | null; }>
parseAsWebPurchaseRedemption(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(options: { webPurchaseRedemption: WebPurchaseRedemption; }) => Promise<WebPurchaseRedemptionResult>
Redeems the web purchase associated with the Redemption Link obtained with [parseAsWebPurchaseRedemption].
| Param | Type | Description |
|---|---|---|
options |
{ webPurchaseRedemption: WebPurchaseRedemption; } |
The WebPurchaseRedemption object obtained from {@link parseAsWebPurchaseRedemption}. |
Returns: Promise<WebPurchaseRedemptionResult>
setMockWebResults(options: { shouldMockWebResults: boolean; }) => Promise<void>
Sets whether the SDK should return mocked results in the web version. This won't affect the iOS and Android versions of the implementation. Default is false
| Param | Type | Description |
|---|---|---|
options |
{ shouldMockWebResults: boolean; } |
Set shouldMockWebResults to true if you want the plugin methods to return mocked values |
setSimulatesAskToBuyInSandbox(options: { simulatesAskToBuyInSandbox: boolean; }) => Promise<void>
iOS only.
| Param | Type | Description |
|---|---|---|
options |
{ simulatesAskToBuyInSandbox |
$ claude mcp add purchases-capacitor \
-- python -m otcore.mcp_server <graph>