In-app purchases go through the owner's own RevenueCat account; there is no thelastapi fee on them. Never ask for the owner's RevenueCat key in the chat.
- Connected?
vibiz_payments { action: "app_store_status" }. If not,vibiz_payments { action: "connect_app_store" }and give the owner theurl: they paste a V2 secret key from their RevenueCat dashboard ▸ Project settings ▸ API keys there. You can't complete it. - Catalog. Plans are the project's products and prices with a
lookup_key(vibiz_payments create_product, in each environment you use). - Set up (one RevenueCat project per app: a project there has one current offering). Read the bundle id from
app.json(expo.ios.bundleIdentifier,expo.android.package) or the Xcode target, thenvibiz_payments { action: "app_store_setup", project_id, env: "development", ios_bundle_id: "com.acme.bakery" }(and again withenv: "production"). Keepios.public_keyand repeatnextto the owner: the App Store product ids to create in App Store Connect, the store credentials to upload in their RevenueCat dashboard, and the webhook if it wasn't registered. - The app. The public key is safe to ship. Use the user id the app already uses for web checkout.
Expo / React Native (npx expo install react-native-purchases; needs a development build, not Expo Go):
import Purchases from 'react-native-purchases';
// app.config: extra or EXPO_PUBLIC_REVENUECAT_IOS_KEY = the VIBIZ_REVENUECAT_IOS_KEY value
Purchases.configure({ apiKey: process.env.EXPO_PUBLIC_REVENUECAT_IOS_KEY!, appUserID: user.id });
// …or after sign-in:
await Purchases.logIn(user.id);
const offerings = await Purchases.getOfferings();
const monthly = offerings.current?.monthly; // the `$rc_monthly` package
if (monthly) await Purchases.purchasePackage(monthly);Swift (the RevenueCat SDK, Swift Package Manager purchases-ios-spm):
import RevenueCat
Purchases.configure(withAPIKey: "<VIBIZ_REVENUECAT_IOS_KEY>", appUserID: user.id)
let offerings = try await Purchases.shared.offerings()
if let pkg = offerings.current?.monthly { _ = try await Purchases.shared.purchase(package: pkg) }- Gate on the server, never only in the app:
import { vibiz } from '@vibiz/app';
if (!(await vibiz.payments.hasActive(userId, 'pro'))) return new Response('Upgrade', { status: 402 });hasActive(user, key) takes the entitlement key (pro; prefer it), a lookup key (pro-monthly), a price id or a store product id, in that order of precedence (a string that is an entitlement key matches only as one), and answers for web checkout and the stores alike. vibiz.payments.entitlements(user) lists what the user has, each with its source.
- Test with an App Store sandbox tester (or a Google Play license tester): sandbox purchases land in
development;vibiz_payments { action: "subscriptions", env: "development", user }shows them withsource: "app_store".
Facts to repeat: Apple or Google pay the owner (after their commission), thelastapi takes no fee on store purchases; the user cancels a store subscription in the store, not through thelastapi.