AppNative › Blog › In-app purchases

How to add in-app purchases to a React, Next.js or Vite app without React Native

Updated November 2026 · By the AppNative team

Short answer: 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.

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.

React, Next.js and Vite in-app purchases at a glance

FrameworksReact, Next.js, Vite, Remix, Astro, SvelteKit, Vue, Nuxt
Bridgewindow.AppNative.iap (no npm package required)
IdentitysetUser(uuid) returns the appAccountToken Apple echoes on every event
Entitlement objectproductId, isActive, expiresDate, willAutoRenew, gracePeriodExpiresDate, revocationDate, signedTransactionInfo
Server eventsApp Store Server Notifications V2 and Google RTDN
Web paymentsStripe, Paddle or Lemon Squeezy unchanged on the web

How to add Apple and Google in-app purchases to a React, Next.js or Vite app

  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 web 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
}

Your backend should verify each entitlement's signedTransactionInfo before granting access, and match appAccountToken to the signed-in user. See the AppNative API docs for copy-paste prompts you can give your AI builder.

What AppNative's in-app purchase layer includes

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.

Common questions

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.

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.

Add in-app purchases with AppNative

In-app purchase guides for other builders

More: In-app purchases for React and Next.js apps · Live Activities for web apps · Widgets for web apps · Rich push notifications