# Sophora Stripe Live Setup

This is the clean production Stripe path for the Sophora site.

## What the site now supports

- Local cart on the Sophora site
- Server-side Stripe Checkout Session creation
- Stripe success and cancel pages
- Stripe webhook endpoint for paid checkout events
- Demo checkout can stay as a fallback

## Required Vercel environment variables

Add these in the `sophora-client-site` Vercel project:

- `STRIPE_SECRET_KEY`
- `STRIPE_WEBHOOK_SECRET`

## Optional Vercel environment variables

- `STRIPE_PRICE_MAP_JSON`
  - Use only if you want site products mapped to Stripe dashboard Price IDs.
  - The site works without this because it can create checkout line items from the catalog.
- `STRIPE_SHIPPING_RATE_IDS`
  - Comma-separated Stripe shipping rate IDs.
- `STRIPE_ALLOWED_COUNTRIES`
  - Defaults to `US`.
- `STRIPE_COLLECT_SHIPPING`
  - Defaults to `true`.
- `STRIPE_AUTOMATIC_TAX`
  - Defaults to `false`.
- `ORDER_FORWARDING_URL`
  - Optional webhook destination if paid orders should also post into Google Sheets / Zapier / Make.
- `ORDER_FORWARDING_BEARER_TOKEN`
  - Optional auth token for that forwarding destination.

## Stripe dashboard steps

1. Finish live-mode business verification.
2. Connect payout bank account.
3. Turn on the payment methods she wants to accept.
4. Create shipping rates in Stripe if shipping should be charged separately.
5. Add a webhook endpoint:
   - Endpoint URL: `https://www.sophoraseamoss.shop/api/stripe-webhook`
6. Subscribe that webhook to at least:
   - `checkout.session.completed`
   - `checkout.session.async_payment_succeeded`

## Site routes

- Live shopping site: `https://www.sophoraseamoss.shop`
- Stripe success page: `https://www.sophoraseamoss.shop/checkout-success`
- Stripe cancel page: `https://www.sophoraseamoss.shop/checkout-cancelled`
- Create checkout session API: `POST /api/create-checkout-session`
- Stripe webhook: `POST /api/stripe-webhook`
- Session lookup API: `GET /api/stripe-session?session_id=...`

## Operational note

If the store sells both one-time products and the subscription product, the subscription must be checked out separately. Stripe Checkout does not support mixing one-time and recurring line items in a single simple checkout flow.
