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
| Field | Where to find it | Example |
|---|---|---|
| Android API key | RevenueCat, public key of your Android app | goog_xxxxxxxx |
| App Store API key (optional) | RevenueCat, public key of your iOS app | appl_xxxxxxxx |
| Entitlement ID | RevenueCat, 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
Add the plugin
In your project's plugin library, add In-App Subscriptions, then fill in the fields.
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.
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 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].