This article was first published on AppContinuity.
Official RevenueCat docs already cover generic identifying customers. This piece is about the exact stack: a React app wrapped with Capacitor, people signing in with Supabase Auth, subscriptions already on Stripe for the web, and RevenueCat deciding the same entitlement on iPhone and Android — without handing the next person on the phone someone else’s premium.
It pairs with why a Stripe subscriber hits a Capacitor paywall: that article is the web-to-app mismatch; this one is the identity wiring that has to be correct first.
The failure mode
You configure RevenueCat early. A $RCAnonymousID:… appears. Someone buys, or a Stripe subscription is later attached to the wrong id. Or you call logIn with an email. Or you sign out of Supabase and leave RevenueCat identified. The next session still looks “paid.” Support hears about it before your dashboards agree.
Paid access is only safe when three identifiers line up on purpose:
Supabase
user.id(stable UUID from Auth)RevenueCat App User ID (custom id after
logIn, not email)Whatever you use to attach Stripe to that same RevenueCat customer
Until they do, web, store, and app each answer “is this person paid?” alone.
A printable Capacitor + RevenueCat + Stripe entitlement checklist covers the cases in this article, as a free PDF.
Configure once, identify after Auth
RevenueCat’s Capacitor flow for “I get my user id later” is: configure without a custom id, then logIn when Auth has a session (Identifying Customers):
import { Purchases } from '@revenuecat/purchases-capacitor';
import { supabase } from './supabase';
await Purchases.configure({ apiKey: publicSdkKey });
const { data: { user } } = await supabase.auth.getUser();
if (user) {
await Purchases.logIn({ appUserID: user.id });
}
supabase.auth.onAuthStateChange(async (event, session) => {
if (event === 'SIGNED_IN' && session?.user) {
await Purchases.logIn({ appUserID: session.user.id });
}
if (event === 'SIGNED_OUT') {
await Purchases.logOut();
}
});
Rules that matter on this stack:
Use
user.id, not email. RevenueCat explicitly advises against emails as App User IDs (guessability and compliance). Supabase emails can change; the user id does not.Do not hard-code an App User ID into
configure. Every install would share purchases.Configure once. Switching identity is
logIn, not a secondconfigure.On SIGNED_OUT, call
logOut()so RevenueCat creates a fresh anonymous id. If you only clear the Supabase session, the SDK can still report the previous customer’s entitlements.
Supabase’s client exposes onAuthStateChange for exactly this kind of side effect (Supabase Auth docs). Wire RevenueCat there (or in one shared auth helper), not ad hoc in every screen.
What aliasing does — and does not — merge
When the current id is anonymous and you logIn with a custom id, RevenueCat may merge (alias) that anonymous customer into the custom id. Webhook fields then often show original_app_user_id as the anonymous id and app_user_id as the custom id, with both in aliases.
When the current id is already a custom id and you logIn with a different custom id, RevenueCat’s documented behavior is: log out the current custom id and log in the new one — no merge. That is the intended account switch. You do not need to call logOut first for that switch, but you should call logOut when the user signs out of your app so the logged-out device is not still identified as them.
If your backend keys premium only on app_user_id and ignores aliases / original_app_user_id, restores and “bought while anonymous, then signed in” flows look like missing subscribers. Resolve any of the merged ids to the same Supabase row.
Gate on entitlements, not on “we saw a login”
After identity is correct, access is still customerInfo.entitlements.active['your_entitlement_id'] (or the same fact from GET /subscribers/{id} on the server) — not “Supabase session exists” and not a boolean you wrote to AsyncStorage.
Client-side CustomerInfo is cached so premium can work offline for a grace period after it was known active; logOut clears that cache. Treat cache as UX, not as the authority your API trusts.
Stripe must use the same App User ID
Importing a Stripe subscription into RevenueCat only unlocks the Capacitor app if the Purchases SDK is identified with the same App User ID you attached the Stripe purchase to (Track External Purchases). Practical pattern:
Checkout completes while the user is signed in with Supabase.
Your backend posts the Stripe
sub_…(or Checkout Session id) to RevenueCat withapp_user_id: <supabase user.id>andX-Platform: stripe.The Capacitor app, after
logInwith that same id, sees the entitlement.
If Stripe was attached to an anonymous id, or to an email string, the signed-in Supabase user will still hit a paywall. That is the story in the first article; identity is the prerequisite.
Sandbox cases that catch the wrong person
Before you trust production:
User A purchases (or gets a Stripe attach) while identified as A → entitlement active.
Sign out (Supabase and
Purchases.logOut) → paywall for anonymous / empty session.Sign in as User B → no A entitlement.
Sign back in as A on a fresh install →
logIn(A)then restore if needed → entitlement returns for A only.Purchase while anonymous, then
logIn(A)→ purchase still on A (alias path); backend accepts alias ids.
A printable checklist that includes these cases: the free entitlement checklist.
Short checklist
Configure RevenueCat once with the public SDK key.
After Supabase Auth has a user,
Purchases.logIn({ appUserID: user.id }).On Supabase sign-out,
Purchases.logOut().Never use email as the App User ID.
Attach Stripe to that same custom id.
Server gates on RevenueCat entitlements for that user, not a client flag.
Webhook / alias handling resolves anonymous and custom ids to one Supabase user.
Run account-switch and anonymous-then-login cases in sandbox.
Sources
RevenueCat, Identifying Customers: https://www.revenuecat.com/docs/customers/identifying-customers
RevenueCat, Getting Subscription Status: https://www.revenuecat.com/docs/customers/customer-info
RevenueCat, Track External Purchases (Stripe): https://www.revenuecat.com/docs/web/integrations/stripe/track-external-purchases
RevenueCat, Caching: https://www.revenuecat.com/docs/test-and-launch/debugging/caching
RevenueCat Capacitor SDK
logIn/logOut: https://github.com/revenuecat/purchases-capacitorSupabase Auth (sessions /
onAuthStateChange): https://supabase.com/docs/guides/auth
If you are wiring this stack yourself, the free Capacitor + RevenueCat + Stripe entitlement checklist is a printable PDF of the cases above. The canonical version of this article lives at https://appcontinuity.com/articles/mapping-supabase-auth-to-revenuecat/.
Top comments (0)