# DashCaddy Billing Setup

DashCaddy website no longer processes Stripe webhooks locally.

Current architecture:
- `dashcaddy.net` handles pricing UI and starts checkout by calling the external license server
- `dashcaddy-license-server` owns Stripe secret usage, webhook handling, subscription state, and license generation
- DashCaddy app instances validate/deactivate against the external license server

## Required website environment

```env
NEXT_PUBLIC_APP_URL=https://dashcaddy.net
NEXT_PUBLIC_LICENSE_SERVER_URL=https://licenses.dashcaddy.net
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_live_your_publishable_key_here
```

## Required license server environment

```env
PORT=3010
APP_BASE_URL=https://licenses.dashcaddy.net
DASHCADDY_WEBSITE_URL=https://dashcaddy.net
STRIPE_SECRET_KEY=sk_live_...
STRIPE_PUBLISHABLE_KEY=pk_live_...
STRIPE_WEBHOOK_SECRET=whsec_...
```

## Stripe product model

One Premium tier, four subscription cadences:
- 1 month — $25
- 3 months — $50
- 6 months — $65
- 12 months — $99

No free trial.
7-day grace period.
Cancel at period end.
One active machine at a time.
Premium features only: `sso`, `recipes`, `swarm`.

## Stripe webhook target

Configure Stripe to send events to the license server, not the website.

Recommended webhook endpoint:

```text
https://licenses.dashcaddy.net/api/stripe/webhook
```

Recommended events:
- `checkout.session.completed`
- `customer.subscription.created`
- `customer.subscription.updated`
- `customer.subscription.deleted`
- `invoice.payment_failed`

## Website behavior

The website pricing page should start checkout via:
- `POST /api/checkout/session` on the external license server

The website-local routes under `src/app/api/checkout` and `src/app/api/webhooks/stripe` are intentionally disabled compatibility stubs and should not be used for production billing.
