Stripe API
Launch provides type-safe tRPC endpoints for all Stripe operations. These endpoints handle payment intents, checkout sessions, and product management.Available Endpoints
stripe.getProducts
Fetches all active products and prices from your Stripe account.
stripe.createPaymentIntent
Creates a payment intent for one-time purchases.
stripe.createCheckoutSession
Creates a checkout session for subscriptions.
stripe.getSubscriptionStatus
Returns the current Stripe subscription for the authenticated user (if any), plus
the local subscription record used for display.
stripe.cancelSubscription
Schedules a subscription to cancel at period end.
stripe.resumeSubscription
Resumes a subscription that was scheduled to cancel at period end.
stripe.changeSubscriptionPlan
Switches between subscription prices (monthly ↔ annual). Upgrades take effect
immediately with proration; downgrades take effect at renewal.
API Structure
Location:apps/api/src/routers/stripe.ts
Authentication
getProducts- Public, no authentication requiredcreatePaymentIntent- Protected, requires authenticated usercreateCheckoutSession- Protected, requires authenticated usergetSubscriptionStatus- Protected, requires authenticated usercancelSubscription- Protected, requires authenticated userresumeSubscription- Protected, requires authenticated userchangeSubscriptionPlan- Protected, requires authenticated user
Customer Management
When a user makes their first payment, a Stripe customer is automatically created and linked to their account:Error Handling
All endpoints return structured errors:Test Checklist
stripe.getProductsreturns productsstripe.createPaymentIntentreturns a client secretstripe.createCheckoutSessionreturns a valid URLstripe.getSubscriptionStatusreturns subscription info (if subscribed)stripe.cancelSubscriptionsetscancel_at_period_endstripe.resumeSubscriptionclearscancel_at_period_endstripe.changeSubscriptionPlanswaps price with correct proration
Troubleshooting
If API calls fail, verify Stripe keys inapps/api/.env (copy from
apps/api/example.env first) and restart the API.
Remove / Disable
To disable payments while you configure Stripe, set:apps/mobile/features/feature-registry.tsx → featureFlags.payments = false
For production removal guidance, see Removing Features.