# v349 - Stripe webhook test-event handling foundation for platform subscriptions

## Purpose

This version adds safe Super Admin-only Stripe webhook test-event handling for Dispatch Spot platform subscriptions. It prepares the platform subscription event feedback loop before add-ons, live checkout, customer portal, payment collection, or live billing are enabled.

## Scope

- Add a Stripe test webhook endpoint at `/api/subscriptions/stripe-test/webhook`.
- Verify Stripe webhook signatures when `STRIPE_WEBHOOK_SECRET` is configured.
- Block live-mode assumptions by ignoring live Stripe events during this test-readiness phase.
- Handle selected safe test events:
  - `customer.subscription.created`
  - `customer.subscription.updated`
  - `customer.subscription.deleted`
  - `invoice.payment_succeeded`
  - `invoice.payment_failed`
- Match events to `WorkspaceSubscription` records by Stripe customer ID or subscription ID.
- Update provider sync status, workspace subscription status, provider note, and last sync timestamp.
- Add Super Admin webhook review visibility at `/admin/stripe-webhooks`.

## Safety rules

- No live charges are created.
- No checkout sessions are created.
- No customer portal sessions are created.
- No payment methods are collected.
- No add-ons are created or changed.
- Workspace Admin remains free of Stripe controls.

## Billing architecture preserved

- Super Admin platform subscriptions use this Stripe path.
- Workspace Admin dispatcher services will use a separate future Stripe path to bill carriers.
- Carrier/company billing to brokers and shippers remains factoring or Net 30 based.
