Skip to content

Instantly share code, notes, and snippets.

View benschac's full-sized avatar
🗑️
Building treasure it dot fun

benjamin benschac

🗑️
Building treasure it dot fun
View GitHub Profile

RevenueCat + Stripe Integration Plan

Overview

  • Goal: unify Stripe payment intents (web) and RevenueCat (mobile IAP) so subscribers are stored, verified, and fulfilled through the same payment service entry point at packages/api/src/services/payment/stripe.service.ts.
  • Scope: backend service layer, webhook handling, Supabase persistence, env/config wiring. Client changes (Expo/Next) are limited to calling the new API contracts that this plan introduces.
  • Out of scope: pricing strategy, UI redesign, or migrating historical transactions (capture them via a one-time sync instead).

Objectives & Success Criteria

  1. stripe.service.ts exposes a typed createPaymentSheet + confirmPayment flow that tags PaymentIntents with the RevenueCat product/entitlement metadata.
  2. New RevenueCat service + webhook keeps Supabase subscriptions (or an equivalent table) in sync for Apple/Google receipts and Stripe payments.

User Profile Caching Implementation Plan

Generated: 2025-01-11
Updated: 2025-01-11 (Middleware approach with complete invalidation strategy)
Status: Ready for Implementation
Impact: 70% reduction in database load, 96.5% fewer profile queries
Implementation Time: 1.5 days (includes proper invalidation)


import { useIsomorphicLayoutEffect } from '@my/ui'
import AsyncStorage from '@react-native-async-storage/async-storage'
import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native'
import type {
ThemeProviderProps,
useThemeSetting as next_useThemeSetting,
} from '@tamagui/next-theme'
import { StatusBar } from 'expo-status-bar'
import { createContext, useContext, useEffect, useMemo, useState } from 'react'
import { Appearance, useColorScheme } from 'react-native'
import { ScrollView, Separator, Settings, SizableText, YStack, isWeb, useMedia } from '@my/ui'
import {
Book,
Cog,
HeartHandshake,
Info,
Instagram,
Lock,
LogOut,
Mail,
import { useIsomorphicLayoutEffect } from '@my/ui'
import AsyncStorage from '@react-native-async-storage/async-storage'
import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native'
import type {
ThemeProviderProps,
useThemeSetting as next_useThemeSetting,
} from '@tamagui/next-theme'
import { StatusBar } from 'expo-status-bar'
import { createContext, useContext, useEffect, useMemo, useState } from 'react'
import { Appearance, useColorScheme } from 'react-native'
import { DatePickerProvider } from '@rehookify/datepicker'
import { Session } from '@supabase/supabase-js'
// import { GlobalStoreProvider } from 'app/utils/global-store'
import React from 'react'
import { AuthProvider } from './auth'
// import { BottomSheetProvider } from './bottomsheet'
// import { BottomSheetModalProvider } from './bottomsheetmodal'
import { CalendarProvider } from './calendar'
import { NotificationProvider } from './notifications'
@benschac
benschac / expo-av patch
Created December 28, 2023 00:17
expo-av next.js video patch
diff --git a/registry.js b/registry.js
index 02470da3c4962ad1bbdc62d9ed295c19ca4905fe..3d1ec8b8153f8aa7a7597d933097301973225f1e 100644
--- a/registry.js
+++ b/registry.js
@@ -4,35 +4,21 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
- * @flow strict
- * @format
var fans = document.querySelectorAll("a");
var fans = [...fans];
var [junk, ...rest] = fans;
var csv = rest
.map((fan) => {
return `${fan.href}, ${fan.textContent}\n`;
})
.join(",");
// Given an array of integers arr, a pair (n,m) is called “special” if arr[n] == arr[m], and n < m.
// Return the number of special pairs.
// Hint: Nested for loops can work for this one, but a hashmap solution will have a better runtime!
// $ specialPairs([1,2,3,1,1,3])
// $ 4 // (0,3), (0,4), (3,4), (2,5)
function specialPairs(arr) {
// let cache = {};
let count = 0;
@benschac
benschac / README.md
Created October 28, 2020 14:41 — forked from david-crespo/README.md
Download tagged photos and videos from Facebook (Python 3)

Why

When you download an archive of your Facebook account, Facebook includes photos and videos you've uploaded, but not photos and videos you're tagged in that were uploaded by other people. This is a script to automatically download those.

Setup

  1. pip3 install selenium
  2. Download the ChromeDriver executable and put it somewhere in your PATH
  3. Set FB_USER_ID and CHROME_PROFILE_PATH in helpers.py
  4. Set CONTAINER_SELECTOR (see below)