Browse the documentation

In-app subscriptions plugin (RevenueCat)

2026-11-08· 3 min read· View as Markdown

This plugin sells Google Play and App Store subscriptions from your website code, through RevenueCat. Your site opens the purchase sheet and receives the result. There's no native code to write and no commission from SaasToStore. Android and iOS use the same calls and the same events.

Platforms

Included
  • Android
  • iOS

Used by the native builds: Android Build (Native), Android TV and iOS. The Android Build (Web) does not read these settings.

Fields to fill in

FieldWhere to find itExample
Android API keyRevenueCat, public key of your Android appgoog_xxxxxxxx
App Store API key (optional)RevenueCat, public key of your iOS appappl_xxxxxxxx
Entitlement IDRevenueCat, the access your subscription gives (same on Android and iOS)premium

The API keys are public by design and end up inside the app. Never paste a secret key here. Without the App Store key, the iOS app has no in-app purchases.

Set it up

  1. Add the plugin

    In your project's plugin library, add In-App Subscriptions, then fill in the fields.

  2. Launch a new build

    On Android, it needs an Android Build (Native) with native navigation. On iOS, any iOS build: launch a new one after setting the App Store key.

  3. Add the calls to your site

    Identify the signed-in person, read their status, then start a purchase from your button.

JavaScript API

const billing = await whenSaasToStore("billing");

window.addEventListener("s2s:billing", (e) => {
  const d = e.detail;
  if (d.type === "identify_result" && d.success) billing.getStatus();
  if (d.type === "status") setPremium(d.isEntitled);
  if (d.type === "purchase_result" && d.success) setPremium(d.isEntitled);
});

if (billing?.isAvailable) billing.identify(currentUser.id);
billing.purchase("premium_monthly"); // from your button

Read In-app purchases for the full guide: events, tests, and iOS apps built before.

Prompt for AI builders

Prompt for Lovable, Bolt or Base44

My website also runs inside an Android and iOS app. Inside the app, window.saastostore?.billing sells Google Play or App Store subscriptions. In a normal browser it doesn't exist, and nothing must change.

When navigator.userAgent includes "SaasToStoreApp" and billing.isAvailable is true:
- call billing.identify(user.id) after sign-in, then billing.getStatus() after the identify_result event;
- make my upgrade button call billing.purchase("[PRODUCT ID]") instead of my web checkout;
- add a "Restore purchases" button that calls billing.restore().

Results arrive as a window event named "s2s:billing". event.detail.type is identify_result, purchase_result, restore_result or status. Unlock premium when status or purchase_result gives isEntitled: true.

On iPhone inside the app, if billing is missing or billing.isAvailable is not true, hide the upgrade button.

Replace the values in [BRACKETS].

Frequently asked questions

Is it available on iOS?+

Yes, in iOS apps built with the App Store key. An iOS app built before doesn't have it: hide your purchase button there until you publish a new build.

Does SaasToStore take a commission?+

No. You pay Google's or Apple's fees and, above its free tier, RevenueCat's.

Can I sell one-time purchases?+

The plugin checks an entitlement, so it's built for subscriptions. Non-subscription products configured in RevenueCat haven't been tested with it.

Why doesn't the purchase sheet open?+

On Android, purchases only work in an app installed from a Google Play test track or from the store, with a product that's active in the Play Console. On iPhone, use a TestFlight build and a sandbox account, with a product that's ready in App Store Connect.

See it with your own site

Paste your URL and get a free Android test build on your phone in about 3 minutes.

Publish now

Keep reading