Required variables
| Variable | Example value | Description |
|---|---|---|
STRIPE_SECRET_KEY | sk_live_... | Stripe secret API key. Use sk_test_... in development. |
STRIPE_PUBLISHABLE_KEY | pk_live_... | Stripe publishable key used client-side. Currently hardcoded — should be moved to env. |
STRIPE_WEBHOOK_SECRET | whsec_... | Signing secret for verifying webhook payloads. |
SESSION_SECRET | (random 32+ char string) | Secret used to sign session cookies. Must be changed from the default "s3cret1". |
Variable reference
Your Stripe secret key. Used server-side to create customers, checkout sessions, and billing portal sessions.
- Development:
sk_test_...(from the Stripe Dashboard test mode) - Production:
sk_live_...(from the Stripe Dashboard live mode)
Your Stripe publishable key. Safe to expose to the browser and used to initialise Stripe.js on the client.Currently this value is hardcoded in
subscribe.tsx. Move it to an environment variable and read it via window.ENV or a loader before deploying to production.- Development:
pk_test_... - Production:
pk_live_...
The signing secret (
whsec_...) used to verify that incoming webhook requests originate from Stripe.- For the Stripe Dashboard endpoint: copy the secret from Developers → Webhooks → your endpoint → Signing secret.
- For local development with the Stripe CLI: the CLI prints the secret when you run
stripe listen.
An arbitrary secret string used to sign the session cookie. Anyone who knows this value can forge valid session cookies.
- Use a randomly generated string of at least 32 characters.
- Rotate this secret if it is ever exposed.
"s3cret1" must be replaced before going to production.Cookie settings
The session cookie is configured with the following options:| Setting | Value | Purpose |
|---|---|---|
httpOnly | true | Prevents client-side JavaScript from reading the cookie. |
secure | true | Transmits the cookie over HTTPS only. |
sameSite | lax | Mitigates CSRF attacks while allowing top-level navigation. |
maxAge | 60 seconds | Cookie lifetime. Adjust for your session duration requirements. |