Skip to main content

OpenAI + Stripe + Firebase in a React Native boilerplate

Does AI Mobile Launcher support this combo?

Heavy lift, but feasible. The boilerplate ships RevenueCat (not Stripe) and Supabase (not Firestore). Both get replaced. OpenAI ships in AI Pro. This combo only makes sense if your billing is a web SaaS that happens to have a mobile app: Apple guideline 3.1.3 limits in-app mention of external payments for consumer categories.

The stack

Setup in five steps

1. Clone Standard, strip RevenueCat

pnpm remove react-native-purchases
# Remove src/features/paywall/services/revenuecat.service.ts
# Replace PaywallScreen with a Stripe Checkout WebView

2. Stripe Cloud Function

// functions/src/createCheckout.ts
import Stripe from "stripe";
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);
export const createCheckout = functions.https.onCall(async (data, ctx) => {
  const session = await stripe.checkout.sessions.create({
    mode: "subscription",
    line_items: [{ price: data.priceId, quantity: 1 }],
    success_url: "myapp://billing/success",
    cancel_url: "myapp://billing/cancel",
    client_reference_id: ctx.auth!.uid,
  });
  return { url: session.url };
});

3. Stripe webhook -> Firestore entitlements

// On customer.subscription.updated:
// firestore.doc("entitlements/{uid}").set({ tier, current_period_end })

4. OpenAI proxy

// functions/src/chat.ts
// Server-side fetch to api.openai.com/v1/chat/completions
// Auth via Firebase ID token, rate-limit via Firestore counter

5. Env

# Firebase Functions secrets
firebase functions:secrets:set STRIPE_SECRET_KEY
firebase functions:secrets:set STRIPE_WEBHOOK_SECRET
firebase functions:secrets:set OPENAI_API_KEY

Why this combo works

For a B2B SaaS with a web app and a mobile companion, this combo gets you the lowest payment fee (2.9% Stripe vs 15-30% Apple) and the tightest Google Cloud integration. One project, one bill, one IAM model. Stripe + Firestore + OpenAI on Firebase Functions is the cheapest infra-per-dollar at any scale.

The constraint is the App Store. Apple is loosening 3.1.3 over time but it is still category-specific. Reader apps, enterprise apps, file storage, business productivity are usually fine. Consumer fitness, dating, photo editing are usually not. Plan the App Store review around the category, not the technology.

Firestore handles real-time, offline cache, and security rules. Pair it with Cloud Functions for the Stripe and OpenAI handlers, and you have zero servers to manage.

What it costs at scale

Line item1K MAU100K MAU
OpenAI gpt-4o-mini~$4~$400
Stripe (2.9% + 30c on $20K MRR)~$10~$1000
Firestore + Cloud Functions~$5~$500
Firebase Auth$0~$50
Total (excl. store fees)~$19~$1950

What this combo does NOT cover

Get this combo

Standard tier ($99). The AI Pro tier ($199) adds the OpenAI REST client to mirror.

Standard tier ($99)AI Pro tier ($199)

Related combos