Purpose
Handles Stripe webhook events for subscription management. Updates both database and Clerk organization metadata.Handled Events
| Event | Action |
|---|---|
checkout.session.completed | Link Stripe customer to org, set status active |
customer.subscription.created | Update subscription status |
customer.subscription.updated | Update subscription status |
customer.subscription.deleted | Set status to canceled |
Architecture
Signature Verification
UsesSTRIPE_WEBHOOK_SECRET to verify webhook authenticity.