React · Next.js · Vite · StoreKit 2
In-app purchases for custom React, Next.js and Vite apps
Custom-built web app, your own stack, your own backend. AppNative adds Apple and Google billing without React Native, without a Capacitor project and without Xcode, and gives your JavaScript a typed bridge to everything StoreKit knows.
How do I add in-app purchases to a React web app without React Native?
Wrap the deployed React, Next.js or Vite app with AppNative. It ships native iOS and Android apps with StoreKit 2 and Google Play Billing compiled in and injects window.AppNative.iap into your page. Call setUser() with a server-generated UUID after login, register onEntitlementsChanged at startup, call showPaywall() from the upgrade button, and verify each signedTransactionInfo on your server. AppNative creates the products and forwards Apple and Google server notifications.
- Frameworks
- React, Next.js, Vite, Remix, Astro, SvelteKit, Vue, Nuxt
- Bridge
- window.AppNative.iap (no npm package required)
- Identity
- setUser(uuid) returns the appAccountToken Apple echoes on every event
- Entitlement object
- productId, isActive, expiresDate, willAutoRenew, gracePeriodExpiresDate, revocationDate, signedTransactionInfo
- Server events
- App Store Server Notifications V2 and Google RTDN
- Web payments
- Stripe, Paddle or Lemon Squeezy unchanged on the web
How to turn a React, Next.js and Vite app into a native mobile app, step by step
Six steps, one codebase, no native development. Each step happens inside AppNative except the first.
- 1
Wrap the deployed app
Give AppNative your URL or repo. Builds are signed and uploaded in the cloud.
- 2
Create products
AppNative creates them in App Store Connect and Google Play.
- 3
Identify the user
After sign-in, await window.AppNative.iap.setUser(uuid) with a UUID your server stores per account. Await clearUser() on logout.
- 4
Listen for entitlement changes
Register onEntitlementsChanged once at startup and post the active entries to your API.
- 5
Gate premium features
Read the plan from your own database, and call showPaywall() from the upgrade button inside the app.
The code your React, Next.js and Vite app needs
Everything native is handled by AppNative. Your web code identifies the user, listens for entitlement changes and opens the paywall. In a normal browser the same button keeps using Stripe.
// 1. Right after sign-in (not inside the buy button)
const token = await window.AppNative?.iap?.setUser(user.iapUuid);
// 2. Once at app start: renewals, expiries, refunds and upgrades land here
window.AppNative?.iap?.onEntitlementsChanged((list) => {
const active = list.filter((e) => e.isActive && !e.revocationDate && !e.isUpgraded);
syncEntitlements(active); // your backend verifies and saves them
});
// 3. Your existing upgrade button
function upgrade() {
if (window.AppNative?.iap) return window.AppNative.iap.showPaywall(); // Apple / Google
window.location.href = "/checkout"; // Stripe, unchanged, on the web
}Full reference and copy-paste prompts for AI builders are in the AppNative API docs.
What your React, Next.js and Vite app gets for in-app purchases
These are real native implementations compiled into the binary — not browser fallbacks — and they're what moves an app past Apple's "minimum functionality" bar.
- Real StoreKit 2 purchase sheet on iOS and Google Play Billing on Android, inside your existing web app
- Auto-renewable subscriptions, consumables, non-consumables, lifetime unlocks and free trials
- Products created for you in App Store Connect and Google Play, including prices, trials and localizations
- Native paywalls in several layouts, with copy and design generated by AI from your brand colors
- window.AppNative.iap bridge: showPaywall, setUser, onPurchase, onEntitlementsChanged, getEntitlements, hasFeature, manageSubscriptions
- Restore Purchases, upgrades, downgrades, grace periods and billing retry handled natively
- Apple App Store Server Notifications V2 and Google Play Real-time Developer Notifications wired to your backend
- Entitlements synced to your own database (Base44 entities, Supabase, Firebase or any API) so web and mobile agree
- Keep Stripe for web and desktop customers while the native app uses Apple and Google billing
- RevenueCat mode if you already run RevenueCat, native StoreKit mode if you'd rather skip the extra fee
React, Next.js and Vite in-app purchases: the options, compared
Why Stripe inside the app gets rejected
App Store Review Guideline 3.1.1 says digital content, subscriptions, credits and premium features bought inside an iOS app have to go through Apple's in-app purchase. A Stripe checkout page loaded inside a wrapped web app is one of the most common rejections for AI-built apps. The fix that keeps your revenue intact: Stripe stays on the web, StoreKit runs in the native app, and both write to the same subscription record.
AppNative vs Capacitor or React Native for IAP
Capacitor and React Native give you a native project plus a purchase plugin, and you still create products, build the paywall, verify receipts and handle server notifications yourself. AppNative covers all of that and builds in the cloud, so your repo stays a web app.
Native StoreKit vs RevenueCat
Native StoreKit mode keeps everything inside your own Apple and Google accounts with no third-party revenue share. RevenueCat adds its own dashboard and analytics on top. AppNative supports both, so you can pick per app and switch later.
React, Next.js and Vite in-app purchases: every question, answered
The exact questions people ask before shipping a React, Next.js and Vite project to the App Store and Google Play.
Is there TypeScript support?
Yes. The bridge returns plain objects, and AppNative's docs list every field so you can type them in your project.
How do I handle Restore Purchases?
The native paywall includes it, and getEntitlements() returns everything StoreKit knows so you can resync at any time.
What stops someone from faking a purchase in the webview?
Your server verifies signedTransactionInfo with Apple's keys and matches appAccountToken to the user. Never trust the client callback alone.
Web app to mobile app: key terms defined
- Native app wrapper
- A native app wrapper is a compiled iOS or Android application that renders your existing web app inside a native web view (WKWebView on iOS, WebView on Android) while exposing real device capabilities — push notifications, biometrics, camera, in-app purchases — to that web code through a JavaScript bridge.
- Hybrid app
- A hybrid app ships web technologies (HTML, CSS, JavaScript) inside a native binary that can be distributed through the App Store and Google Play. It differs from a progressive web app, which is installed from the browser and cannot be listed in either store.
- App Store guideline 4.2 (minimum functionality)
- Apple's rule that an app must do more than repackage a website. Apps that add native capability — push notifications, biometric login, camera use, offline support, widgets, in-app purchases — satisfy it; a bare website in a shell does not.
- Bundle ID / package name
- The permanent reverse-domain identifier for your app (for example com.yourcompany.yourapp). It's registered once with Apple and Google and can never be changed for a published app, so it must be decided before your first submission.
- Code signing and provisioning profile
- Apple requires every binary to be signed with a distribution certificate and matched to a provisioning profile tied to your bundle ID and team. Android requires an upload keystore. Without them a build cannot be installed or submitted.
- TestFlight
- Apple's beta distribution service. Uploading a signed build to TestFlight lets up to 100 internal testers install the app immediately, before public App Store review — the fastest way to see your wrapped app on a real device.
- Over-the-air update
- Because a wrapper renders your live web app, deploying your web app updates the mobile experience instantly with no store review. A new native build is only required when something inside the binary changes: icon, splash screen, bundle ID or a native capability.
- StoreKit and Google Play Billing
- The in-app purchase systems Apple and Google require for selling digital goods inside an app. Stripe stays valid on the web, so most apps run both and grant the same entitlement from either payment source.
React, Next.js and Vite in-app purchases: frequently asked questions
Can I add StoreKit to a web app?
Not in a browser. Inside an AppNative-wrapped app, your web code gets full StoreKit 2 through window.AppNative.iap.
Do I need a Mac?
No.
Does it work with Supabase or Firebase backends?
Yes. The sync route writes wherever your user data lives.
Native features only AppNative adds to a wrapped web app
In-app purchases, Live Activities, WidgetKit widgets and rich push are compiled into your binary as real native extensions — designed through AI chat, driven by your data.
Sell subscriptions with Apple and Google in-app purchases
StoreKit 2 and Google Play Billing for apps built with any AI builder or coding agent. Products created for you, native paywall, entitlements synced to your database, Stripe kept for web.
Ship from your AI app builder
Using an AI builder instead of a custom stack? Pick its guide below.
Deep dives by builder and feature
Step-by-step guides for the specific thing you're trying to ship — push, in-app purchases, widgets, store submission — for Lovable and Base44 apps, plus how AppNative compares to Median.co and Despia.
Lovable mobile app guides
In-app purchases, RevenueCat, Capacitor, Stripe rules and Google Play for Lovable apps, with prices checked on each vendor's site.
Publishing guides
Apple and Google rules, costs, review times and rejections, checked against the official pages.
Start selling subscriptions in your React, Next.js and Vite app
Connect your repo, toggle the native features you need, press Build. Your first TestFlight build can be in testers' hands today — and your React, Next.js and Vite workflow doesn't change at all.