This plugin sells Google Play 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. It works on Android today; iOS is coming later.
Platforms
Included- Android
- iOS — coming later
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
| Field | Where to find it | Example |
|---|---|---|
| Android API key | RevenueCat, public key of your Android app | goog_xxxxxxxx |
| Entitlement ID | RevenueCat, the access your subscription gives | premium |
The API key is public by design and ends up inside the app. Never paste a secret key here.
Set it up
Add the plugin
In your project's plugin library, add In-App Subscriptions, then fill in the two fields.
Launch a new build
It needs an Android Build (Native) with native navigation.
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 buttonRead In-app purchases for the full guide: events, tests, and what to do on iOS.
Prompt for AI builders
Prompt for Lovable, Bolt or Base44
My website also runs inside an Android app. Inside the app, window.saastostore?.billing sells Google Play 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, hide the upgrade button.Replace the values in [BRACKETS].