Skip to content
supastack
Browse documentation
WebNext.js

For AI agents: fetch the complete documentation index at /llms.txt, the full documentation corpus at /llms-full.txt, the agent skill at /skill.md, or this page as Markdown at /docs/web/billing.md (or send Accept: text/markdown).

Payments and subscriptions

Stripe checkout, plan management, and the entitlement boundary.

Choose and test your payment service

Billing handles payments. Access permissions are stored separately as entitlements. Complete persisted account setup, then open /billing in the running Web app to see the plan interface. With BILLING_PROVIDER=local, you are exploring local behavior rather than collecting real money.

Choose one supported payment provider, follow its setup guide, create your own test product and price, and copy the named server settings into apps/web/.env.local. Save and restart the Web server. Complete one checkout using that provider's sandbox instructions, then inspect the workspace's access state after the provider's webhook arrives. A webhook is the provider's signed message to your server about a payment event.

A success page alone does not unlock features. If checkout completes but access remains inactive, check the provider's webhook delivery and your server's event processing before repeating payment. Test cancellation and expired access as well. Phone purchases use the separate RevenueCat/store setup, not this Web checkout.

Web billing

The Web application supports the billing provider you select with BILLING_PROVIDER; Stripe is one option. Open /billing for Web plans and subscription management. Follow the selected provider's guide to set its server-only credentials, product or price IDs and webhook verification settings in the matching test or live environment.

Authorize through entitlements

A checkout redirect is not evidence of active access. The server-owned entitlement decides whether a workspace can use a paid capability. Check that entitlement at the action boundary even when the interface already hides the action.

Verify the lifecycle

Use sandbox events to verify activation, updates, cancellation, and webhook handling. Keep repeated events safe and ensure an inactive entitlement blocks paid operations. Native mobile purchases remain a separate RevenueCat integration boundary.

Setup and configuration

The plan catalog lives in src/product-plans.ts and drives the /billing surface and /choose-plan onboarding step. Billing is configured server-side with BILLING_PROVIDER=stripe, STRIPE_SECRET_KEY, the price ids for each plan and interval, and STRIPE_WEBHOOK_SECRET. Lemon Squeezy is available as an alternative adapter.

Seat-based plans use the editable seat steppers (src/seat-count.ts); the quantity travels with the checkout session so the billed seats match the workspace. Plans can also declare meteredUsage in src/product-plans.ts so the hourly billing.usage-report job reports usage_counter deltas to Stripe billing meters, while workspace owners set monthly AI budgets and hard per-meter ceilings under Settings → Usage (USAGE_METERS in src/usage-meters.ts).

Checkout: POST /api/billing/checkout
Portal:   POST /api/billing/portal
Webhook:  POST /api/billing/webhook  (signature-verified)

Implementation workflow

A checkout redirect is only a pending intent — access changes when the signed webhook lands and the server-owned entitlement updates. Gate paid actions with the entitlement check at the server boundary (entitlement-gate.tsx / entitlement-check.ts) even when the interface already hides them.

The customer portal handles plan changes, cancellation, and payment methods. Keep subscription state readable by workspace members and keep native mobile purchases behind the separate RevenueCat boundary.

Frequently asked questions

14 questions

What is supastack?

supastack is a modular foundation for building AI-powered SaaS products. It brings together common infrastructure so you can focus on product-specific features.

Does it support web and mobile?

Yes. supastack includes Next.js and Expo apps as starting points for web and mobile experiences.

What authentication is included?

Better Auth covers email OTP, magic-link, and social sign-in; email/password stays available at the API layer and through the Auth.js credentials engine for products that need it. Personal workspaces are provisioned with the account so product records stay scoped from day one.

How does it support AI?

supastack includes configurable multi-provider AI, usage tracking, budgets, and encrypted bring-your-own-key support.

How are subscriptions handled?

For products built on the kit, Stripe billing, subscriptions, and entitlements form the paid-access foundation. Provider secrets stay server-only.

Where does my product-specific code live?

Product-specific features remain in a separate codebase while the product configures and integrates supastack’s foundation modules.

How does supastack pricing work?

The kit is a one-time purchase with lifetime updates: One Platform at $249 (temporary launch price, $100 off the regular $349) — your pick of Next.js (Web), Expo (iOS & Android), or Tauri (macOS & Windows Desktop) — or the All Platforms Bundle at $499 (temporary launch price, $100 off the regular $599) with every platform and the full monorepo, plus $75 per extra developer seat. No kit subscription. Checkout on this site delivers your license key by email, with repository access via GitHub invite.

How do workspaces scope my data?

User-owned records are scoped by workspaceId. Identity, entitlements, AI usage, billing events, and audit entries stay inside the personal workspace boundary.

How do background jobs work?

Trigger.dev is the explicit job runtime. The JobRunner contract only promises enqueue, status, and cancel—workflow semantics stay Trigger.dev-specific and explicit.

How is email different from outreach?

Transactional email covers product workflows such as completion notices. Cold outreach and campaigns are product concerns outside this kit’s email module.

How do mobile purchases work?

Mobile includes native purchases and restore through RevenueCat, with access verified by your server. Configure the store accounts and complete device testing before release. Web billing remains separate.

Where do AI provider keys live?

Bring-your-own-key credentials are encrypted and stay server-only. Keys are redacted from logs; usage and budgets remain visible at the workspace level.

Which payment methods does checkout accept?

The Stripe-hosted checkout accepts cards and can also offer Alipay and WeChat Pay once those wallets are enabled on the Stripe account — handy for buyers in China. Wallet authorizations confirm asynchronously, so the license page updates as soon as the payment clears.

Can I get a refund?

After you've got access to the repository, supastack is yours forever, so it cannot be refunded. But rest assured, you get the complete source code with lifetime updates to build and ship unlimited products for yourself or clients. You just cannot resell the code or redistribute the repository as a starter kit or template.

EN
Theme