← ClaudeAtlas

revenuecat-supabase-entitlementslisted

Sync RevenueCat subscription state into a Supabase entitlements table so Row Level Security can gate premium content server-side, with an Edge Function webhook that checks the shared Authorization header, dedupes on event id, then fetches the customer from GET /v1/subscribers and writes expiry-based truth instead of guessing from the event type. Use this whenever the work touches RevenueCat webhooks, entitlements or CustomerInfo, app_user_id mapped to a Supabase auth uid, INITIAL_PURCHASE, RENEWAL, CANCELLATION, EXPIRATION, BILLING_ISSUE or TRANSFER events, purchases_flutter or react-native-purchases with Supabase, paywall states, premium rows hidden from non-subscribers, sandbox purchases unlocking production, or supabase functions deploy --no-verify-jwt. Reach for it even for "just store whether the user is pro", because the client can be patched and the event type lies about access. Not for one-time purchases through Paddle (paddle-webhooks) or web billing.
tanfust/skills · ★ 0 · API & Backend · score 73
Install: claude install-skill tanfust/skills
# RevenueCat entitlements in Supabase The client already knows whether the user is subscribed; the SDK caches `CustomerInfo` and the paywall reads it instantly. The problem is that a client can be patched, and Postgres cannot ask the SDK. So a premium table needs an `entitlements` row it can join on, and that row is written by a webhook you own. The failures are all quiet: a `BILLING_ISSUE` handled as "revoke" cuts off a customer whose card retry succeeds tomorrow; a `CANCELLATION` handled as "keep until expiry" keeps access after a refund; a `TRANSFER` skipped because it carries no `entitlement_ids` leaves the old account subscribed forever; a TestFlight tester's sandbox purchase unlocks production rows. RevenueCat's own guidance avoids all of this with one move, and this skill is that move plus the checks. Extracted from a shipped Flutter and Supabase codebase. Every RevenueCat fact is quoted with its source in `references/EVENTS.md`; the table, function and paywall states are in `references/SCHEMA.md`. ## Order of work 1. Make the app user id the Supabase uid 2. Create the table and the RLS that reads it 3. Deploy the webhook function without JWT verification and with its own auth 4. Treat the event as a trigger: dedupe, fetch, write 5. Keep sandbox out of production 6. Render the paywall from the SDK, gate content from the table 7. Verify ## 1. Make the app user id the Supabase uid Everything downstream keys on `event.app_user_id` being a value that exists in `auth.