An iOS or Android app sells subscriptions and one-time unlocks in the App Store and Google Play through your own RevenueCat account. thelastapi keeps its key sealed, sets the app up there from the project's catalog in one call, takes its events in, records what each user bought, and gives the app's server one answer across web checkout and the stores: vibiz.payments.hasActive(user, 'pro').
app (RevenueCat SDK, public key) ── purchase ──▶ App Store / Google Play ──money──▶ you
│ receipt
▼
your RevenueCat project ── events ──▶ thelastapi ──▶ your app's webhook
▲
app server: vibiz.payments.hasActive(user, 'pro') ────┘ (read live, a minute's cache)Fees
Apple or Google pay you directly (after their own commission). The money never passes through thelastapi and there is no thelastapi fee on store purchases. Web checkout keeps its own fees (Payments).
Connect once
Your RevenueCat key is a secret: you type it on a console page, never in a chat.
- Your agent makes the link:
vibiz_payments { action: "connect_app_store" },vibiz payments app-store connect, orPOST /v1/payments/app-store/link. - In your RevenueCat dashboard ▸ Project settings ▸ API keys ▸ + New secret API key, version V2, with read & write on Project configuration and read on Customer information.
- Open the link signed in to the console and paste it. It is checked with a real call and stored encrypted. A RevenueCat secret key reaches one project: if your apps live in several RevenueCat projects, paste one key for each.
Only the account owner can complete or disconnect it.
Set an app up
vibiz payments app-store setup --ios com.acme.bakery --android com.acme.bakery(vibiz_payments { action: "app_store_setup", project_id, ios_bundle_id }, or POST /v1/projects/:id/payments/app-store/setup.) In your RevenueCat account this creates (or finds) the app, a product for every price with a lookup_key, one entitlement per plan (Pro → pro), and a default offering with packages. It registers the webhook and answers:
- the public SDK key (
appl_…), also in the app's env asVIBIZ_REVENUECAT_IOS_KEY(Android:VIBIZ_REVENUECAT_ANDROID_KEY). It is safe to ship in the app; - the product ids to create in App Store Connect (
com.acme.bakery.pro_monthly) and Play Console (pro_monthly:monthly); next: the steps left, each with where to do it.
Run it again after changing prices: it never makes anything twice. Development and production are separate: sandbox purchases land in development, real ones in production. Once production is set up, its offering is what live buyers see, so a development setup adds products but leaves the offering alone.
One RevenueCat project per app. A RevenueCat project has one current offering for all its apps, so each project here needs its own (setup says so, store_project_in_use). Moving a live app to another RevenueCat project is the owner's.
What only you can do
- Upload the store credentials in your RevenueCat dashboard ▸ Apps: the App Store In-App Purchase Key and App Store Connect API key; the Google Play service account (it can take up to 36 hours).
- Create the products with exactly the returned ids in App Store Connect and Play Console. Prices are set there.
- If the webhook could not be registered for you (your RevenueCat plan has no webhooks, or the key lacks the Integrations permission), add it in your RevenueCat dashboard ▸ Project settings ▸ Integrations ▸ Webhooks with the URL and Authorization value from console ▸ Payments ▸ App Store & Google Play. Purchases are read live in the meantime.
In the app
The app logs the user in with the same user id it passes to web checkout, then the server checks. See the guide for Expo and Swift.
// server
const premium = await vibiz.payments.hasActive(userId, 'pro'); // web or store
const what = await vibiz.payments.entitlements(userId); // [{ key: 'pro', source: 'app_store', … }]Store subscriptions show in vibiz.payments.subscription(user) and the subscriptions list with source: 'app_store' or 'play_store'. Only the buyer cancels them, in the store: canceling one here answers 409 store_subscription. Changes reach the app's webhook as subscription.created, subscription.updated and subscription.canceled, signed like every payment event.
Nothing depends on webhooks
Each check for a user reads their subscriptions and one-time purchases live from your RevenueCat account (reused for a minute, or ten while the webhook works) and fixes what is recorded. If the account doesn't answer, the last recorded state is used. A subscription counts only until its period or grace period ends, and a refunded unlock never counts.
Matching in hasActive
hasActive(user, 'x') checks, in order: an entitlement key; if x is one of the project's entitlement keys it matches only as that; otherwise a lookup key, a price id, a store product id.