Stripe
Payments and subscriptions: Checkout, the customer portal, webhooks and invoicing.
Install
uv add stripenpm install stripebrew install stripe/stripe-cli/stripeEnvironment
STRIPE_SECRET_KEYsecretsk_test_... in development, sk_live_... in productionSTRIPE_PUBLISHABLE_KEYpk_..., safe in the browserSTRIPE_WEBHOOK_SECRETsecretwhsec_..., verifies that webhook calls came from Stripe
Patterns to follow
Your database is the source of truth for plans and entitlements; Stripe mirrors prices and takes payment
Hosted Checkout and the customer portal instead of building card forms
Webhooks for every subscription change, verified with the signing secret and handled idempotently
Gate features on entitlements resolved from the plan, never on a Stripe price id scattered in code
Record a finished checkout when the buyer returns too, so access doesn't wait on the webhook
Avoid
Trusting the success redirect alone: renewals, cancellations and failed payments only arrive as webhooks
Parsing the webhook body as JSON before verifying its signature against the raw bytes
Using live keys in development, or test keys in production