Route public health checks to the API, backfill and synchronize job opportunities, stabilize SPA smoke tests, and document operator-only production steps.
2.6 KiB
Stripe activation
The application code is complete. Activate it in Stripe test mode first; test and live mode have different API keys, price ids, webhook endpoints/signing secrets, and customer data.
Official references:
- https://docs.stripe.com/subscriptions
- https://docs.stripe.com/customer-management/integrate-customer-portal
- https://docs.stripe.com/webhooks?lang=dotnet
Test-mode setup
-
Create one recurring monthly Premium product/price.
-
Enable the customer portal for subscription management and cancellation.
-
Register
https://jobs.cesnimda.uk/api/billing/webhookas an HTTPS webhook endpoint for:customer.subscription.createdcustomer.subscription.updatedcustomer.subscription.deleted
-
Add the test-mode values to
/opt/job-tracker/shared/.env:STRIPE_SECRET_KEY=<test secret key> STRIPE_PRICE_PREMIUM=<test recurring price id> STRIPE_WEBHOOK_SECRET=<test endpoint signing secret> -
Restart/redeploy the backend without printing those values.
Never put the values in Git, chat, screenshots, issue text, or CI logs. Stripe requires the raw request body for signature verification; the implemented endpoint reads it before constructing the signed event.
Acceptance check
Use a disposable, authenticated Jobbjakt account:
- Account settings reports billing enabled and offers Upgrade.
- Upgrade opens Stripe-hosted Checkout for the configured monthly price.
- Completing a Stripe test subscription returns to
/settings?billing=success. - The signed subscription webhook stores the Stripe customer/subscription/status and grants the
Premiumrole. /api/auth/meexposes Premium entitlements and the UI unlocks Premium capabilities.- Manage billing opens the Stripe customer portal.
- Cancel in the portal and confirm an updated/deleted subscription webhook removes Premium when the subscription is no longer active or trialing.
- Replay one event from Stripe Workbench and confirm role/state remain idempotent.
Live-mode cutover
Repeat the product/price, portal, and webhook setup in live mode. Replace all three environment values as one change; never mix a test price or endpoint secret with a live API key. Complete one real low-risk subscription and cancellation, confirm the webhook delivery log is green, then remove the disposable account if it is no longer needed.
Rollback
Removing all three environment values disables new Checkout/portal sessions without deleting billing history. Do not manually remove Premium roles while Stripe still reports an active subscription; fix webhook delivery and replay the authoritative subscription event instead.