AppNative › Blog › In-app purchases

How to sync Apple and Google in-app purchases to Supabase

Updated November 2026 · By the AppNative team

Short answer: Wrap your app with AppNative, then create a Supabase Edge Function that verifies Apple's signedTransactionInfo and Google purchase tokens and upserts a row in a subscriptions table keyed by user id. Call it from onEntitlementsChanged in your web code and point AppNative's Apple and Google server notifications at it. Your Stripe webhook writes to the same table, and Row Level Security protects it.

Lovable, Bolt.new and plenty of hand-built apps run on Supabase. AppNative handles StoreKit 2 and Google Play Billing in the native app and calls a Supabase Edge Function with every verified purchase, renewal and refund, so one table tells you who is paid.

Supabase in-app purchases at a glance

EndpointSupabase Edge Function (Deno)
Tablesubscriptions: user_id, source (apple, google, stripe), product_id, status, expires_at
User matchingappAccountToken from setUser(uuid) ties purchases to a Supabase user
EventsPurchases, renewals, grace periods, refunds and cancellations
SecurityServer-side verification plus RLS
Works withLovable, Bolt.new, v0, Claude Code and custom React apps

How to sync Apple and Google in-app purchases to Supabase

  1. Wrap your app. AppNative builds the native iOS and Android apps with billing included.
  2. Create the subscriptions table. One row per user and source, with status and expiry, protected by RLS.
  3. Add the Edge Function. Verify the signed transaction, check the appAccountToken matches the user, and upsert the row.
  4. Connect both directions. Call the function from onEntitlementsChanged in the app, and paste its URL into AppNative for server notifications.

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.

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.

AppNative vs Median.co, Despia and other wrappers

Most webview wrappers expose a purchase bridge and leave the rest to you: creating products in App Store Connect, building a paywall, verifying transactions, handling renewals and refunds. AppNative does all of that. It creates the products, generates the native paywall, verifies every transaction, and wires Apple and Google server notifications into your own database.

Common questions

Do I need a separate table for Apple and Stripe?

No. One table with a source column keeps the app logic simple: a user is paid if any active row exists.

What if a notification is missed?

onEntitlementsChanged also fires whenever the app returns to the foreground, so the app resyncs on its own.

Can Supabase receive App Store Server Notifications?

Yes, through an Edge Function. AppNative forwards Apple and Google events to it.

Does this work with Lovable apps on Supabase?

Yes. It's the most common setup we see.

Add in-app purchases with AppNative

In-app purchase guides for other builders

More: In-app purchases with Supabase · Live Activities for web apps · Widgets for web apps · Rich push notifications