Skip to main content

Purchases Capacitor plugin

Implement in-app subscriptions and purchases with RevenueCat SDK for cross-platform monetization

Install

bun add @revenuecat/purchases-capacitor bunx cap sync
npm, pnpm or yarn
  • npm install @revenuecat/purchases-capacitor
  • pnpm add @revenuecat/purchases-capacitor
  • yarn add @revenuecat/purchases-capacitor

Guide

How to use Purchases in Capacitor

Using @revenuecat/purchases-capacitor

Capacitor in-app purchases and subscriptions made easy. Support for iOS and Android.

Install

bun add @revenuecat/purchases-capacitor
bunx cap sync

What This Plugin Exposes

  • configure - Sets up Purchases with your API key and an app user id.
  • getVirtualCurrencies - Fetches the virtual currencies for the current subscriber.
  • invalidateVirtualCurrenciesCache - Invalidates the cache for virtual currencies.
  • getCachedVirtualCurrencies - The currently cached if one is available. This value will remain null until virtual currencies have been fetched at least once with or an equivalent function.

Example Usage

configure

Sets up Purchases with your API key and an app user id.

import { Purchases } from '@revenuecat/purchases-capacitor';

await Purchases.configure({} as PurchasesConfiguration);

getVirtualCurrencies

Fetches the virtual currencies for the current subscriber.

import { Purchases } from '@revenuecat/purchases-capacitor';

await Purchases.getVirtualCurrencies();

invalidateVirtualCurrenciesCache

Invalidates the cache for virtual currencies.

import { Purchases } from '@revenuecat/purchases-capacitor';

await Purchases.invalidateVirtualCurrenciesCache();

getCachedVirtualCurrencies

The currently cached if one is available. This value will remain null until virtual currencies have been fetched at least once with or an equivalent function.

import { Purchases } from '@revenuecat/purchases-capacitor';

await Purchases.getCachedVirtualCurrencies();

Full Reference

Keep going from Using @revenuecat/purchases-capacitor

If you are using Using @revenuecat/purchases-capacitor to plan payments and purchases, connect it with Capgo Pricing for the product workflow in Capgo Pricing, Payment system for the implementation detail in Payment system, @capgo/native-purchases for the implementation detail in @capgo/native-purchases, Getting Started for the implementation detail in Getting Started, and Revenue Playbook for the implementation detail in Revenue Playbook.

FAQ

Purchases plugin FAQ

How do I install the Purchases plugin in a Capacitor app?

Run "bun add @revenuecat/purchases-capacitor" (or "npm install @revenuecat/purchases-capacitor"), then run "bunx cap sync" so the iOS and Android projects pick up the native code. Import it from "@revenuecat/purchases-capacitor" in your app code.

Does @revenuecat/purchases-capacitor work with React, Vue and Angular?

Yes. Purchases is a Capacitor package, so it works with any web framework that runs inside Capacitor, including Ionic, React, Vue, Angular, Svelte and plain JavaScript.

Which Capacitor version does @revenuecat/purchases-capacitor support?

Capgo plugins follow Capacitor's major version: use the plugin major version that matches your Capacitor major version (for example plugin v8 with Capacitor 8). The compatibility table in the GitHub README lists the maintained versions.

Is @revenuecat/purchases-capacitor free and open source?

Yes. The source code is public on GitHub at https://github.com/RevenueCat/purchases-capacitor/ and the package is free to install from npm. Bug reports and pull requests are welcome.

Can I update code that uses Purchases without an App Store review?

Installing or upgrading the plugin changes native code, so it needs a new store build. After that, JavaScript, HTML and CSS changes that call the plugin can ship instantly with Capgo live updates.

Ship Purchases changes without waiting for app review

Once the plugin is in your store build, Capgo live updates push your JavaScript, HTML and CSS changes to users in minutes.

Start with Capgo