Template · Pro

Expo Stripe template: Stripe Checkout with the server routes

Stripe as a ReadyNative module: hosted Checkout in the system browser, no native payments SDK, and the checkout, entitlements and webhook routes in your own tree.

What you get

This sells subscriptions through Stripe's hosted Checkout in the system browser, so there's no native payments SDK at all (@stripe/stripe-react-native is deliberately not used). src/lib/payments.ts implements the shim - entitlements come from GET /api/stripe/entitlements for whoever the request's session proves - and the server side lives in your tree: src/app/api/stripe/{checkout,entitlements,webhook,return}+api.ts with the shared logic in src/server/stripe.ts. You also get /paywall as a modal, tests for both halves, and /examples/paywall with --with-examples. @/lib/payments keeps the same API whichever option you pick - pick Stripe when you're selling to the web as well, or when the 30% store cut isn't something you have to pay.

Screens added
/paywall/
Tests included
2
npm packages
stripe ^22.6.2
Runs in Expo Go
Yes

Which tier includes it

Pro. Payments is a Pro category: the free tier and Starter ship it switched off. Pro is one payment with lifetime updates. See pricing.

What needs a key

KeyWhere it goesRequired
EXPO_PUBLIC_API_URLApp (.env)Optional
EXPO_PUBLIC_STRIPE_PUBLISHABLE_KEYApp (.env)Yes
STRIPE_SECRET_KEYServer only (no EXPO_PUBLIC_ prefix)Yes
STRIPE_WEBHOOK_SECRETServer only (no EXPO_PUBLIC_ prefix)Yes
STRIPE_PRICE_IDServer only (no EXPO_PUBLIC_ prefix)Yes
STRIPE_ALLOW_ANONYMOUSServer only (no EXPO_PUBLIC_ prefix)Optional

Set it up

bun run setup --payments stripe
  1. Stripe: create a Product with a recurring Price at https://dashboard.stripe.com/products and copy the price id (price_...) into .env as STRIPE_PRICE_ID (server-only, no EXPO_PUBLIC_ prefix).
  2. Stripe: copy the secret key (sk_test_...) from https://dashboard.stripe.com/apikeys into .env as STRIPE_SECRET_KEY, and the publishable key as EXPO_PUBLIC_STRIPE_PUBLISHABLE_KEY.
  3. Stripe: add a webhook endpoint <API_URL>/api/stripe/webhook at https://dashboard.stripe.com/webhooks (events: checkout.session.completed, customer.subscription.updated, customer.subscription.deleted) and put its signing secret (whsec_...) into .env as STRIPE_WEBHOOK_SECRET. Locally: stripe listen --forward-to localhost:8081/api/stripe/webhook.
  4. Stripe: the routes under src/app/api/stripe/ only run with backend/api-routes (web.output "server"); set EXPO_PUBLIC_API_URL to that server's origin. Without it the paywall shows "Configure Stripe".
  5. Stripe: checkout needs a signed-in user - pick an auth module. The API routes resolve the caller server-side from the session (src/server/session.ts, sent via auth.getAuthHeaders()), never from a client-supplied id; with auth none they answer 401 unless you set STRIPE_ALLOW_ANONYMOUS=true (trusts client ids - demos only).

Then bun run doctor lists any key still missing, with a link to where you get it. The full guide: Stripe Checkout docs.

Pairs with

Needs: Backend (API routes). Setup asks for it in the same run.

Read more

Questions

Which ReadyNative tier includes Stripe Checkout?

Pro. Payments is a Pro category: the free tier and Starter ship it switched off. Pro is one payment with lifetime updates.

Does Stripe Checkout run in Expo Go?

Yes: Expo Go OK.

Which keys does Stripe Checkout need?

In the app's .env: EXPO_PUBLIC_API_URL (optional), EXPO_PUBLIC_STRIPE_PUBLISHABLE_KEY. Server-only, never EXPO_PUBLIC_: STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET, STRIPE_PRICE_ID, STRIPE_ALLOW_ANONYMOUS (optional). bun run doctor lists any that are missing.

Can I switch from Stripe Checkout to another option later?

Yes. @/lib/payments keeps the same API in every payments option (Stripe Checkout, RevenueCat and Adapty), so screens written against it keep working when you switch.

Why Stripe Checkout instead of in-app purchase?

Stripe fits when you sell to the web too, or when what you sell is not digital goods that Apple and Google require in-app purchase for. It runs on hosted Checkout in the system browser, with no native payments SDK.

Does checkout work without sign-in?

Not by default. With auth none the API routes answer 401 unless you set STRIPE_ALLOW_ANONYMOUS=true, which trusts client ids and is for demos only.

Get it

Get Pro · Try the free tier on GitHub