2.0 KiB
2.0 KiB
Stripe Billing Integration
This console now routes all purchase entry points through Stripe:
/prices- product detail pages
/panel/subscription
The browser only needs public Stripe price_id values. Secret keys stay in accounts.svc.plus.
Required Environment Variables
Set these in console.svc.plus:
NEXT_PUBLIC_STRIPE_PRICE_XSTREAM_PAYGO=price_xxx
NEXT_PUBLIC_STRIPE_PRICE_XSTREAM_SUBSCRIPTION=price_xxx
NEXT_PUBLIC_STRIPE_PRICE_XSCOPEHUB_PAYGO=price_xxx
NEXT_PUBLIC_STRIPE_PRICE_XSCOPEHUB_SUBSCRIPTION=price_xxx
NEXT_PUBLIC_STRIPE_PRICE_XCLOUDFLOW_PAYGO=price_xxx
NEXT_PUBLIC_STRIPE_PRICE_XCLOUDFLOW_SUBSCRIPTION=price_xxx
If a value is missing, the related purchase button stays visible but reports that Stripe pricing is not configured.
Local Integration Checklist
- Configure all
NEXT_PUBLIC_STRIPE_PRICE_*values with Stripe test-modeprice_...ids. - Start
accounts.svc.pluswith Stripe server-side settings. - Start this console with
yarn dev. - Sign in with a normal user account.
- Open
/pricesor/panel/subscriptionand start checkout. - Complete a Stripe test payment.
- Confirm the browser returns to
/panel/subscription?checkout=success.... - Confirm the subscription record appears in the subscription panel.
- Open "Manage Stripe billing" and confirm the customer portal opens.
Expected Flow
- The console calls
/api/auth/stripe/checkout. - The BFF proxies the request to
accounts.svc.plususing the current account session. accounts.svc.pluscreates the Stripe Checkout Session.- Stripe redirects back to the console.
- Stripe webhooks update the account service subscription record.
- The console reads the final state from
/api/auth/subscriptions.
Notes
- The console does not store Stripe secret keys.
- Sensitive payment methods such as crypto QR flows are intentionally removed from the purchase UI.
- Use Stripe test mode first; do not validate this flow against live prices until webhook delivery is confirmed.