Stripe Webhook Edge Function
Handles incoming Stripe webhook events to keep subscription state in sync. Processes checkout completions, subscription updates, and cancellations.
POST /stripe-webhook
Stripe signature verification (not JWT)
This function is called by Stripe when subscription events occur. It verifies the webhook signature and updates the database accordingly.
Handled events:
checkout.session.completed
customer.subscription.updated
customer.subscription.deleted
Tables touched:
Environment variables required:
200 - { received: true, eventType: string }
400 - Missing signature or invalid signature
500 - Missing environment variables or processing error
Fileoverview
Stripe Webhook Edge Function
Handles incoming Stripe webhook events to keep subscription state in sync. Processes checkout completions, subscription updates, and cancellations.
Endpoint
POST /stripe-webhook
Auth
Stripe signature verification (not JWT)
Remarks
This function is called by Stripe when subscription events occur. It verifies the webhook signature and updates the database accordingly.
Handled events:
checkout.session.completed: Creates/updates subscription after successful checkoutcustomer.subscription.updated: Syncs plan changes and cancellation statecustomer.subscription.deleted: Resets user to Free planTables touched:
Environment variables required:
Returns
200 - { received: true, eventType: string }
Returns
400 - Missing signature or invalid signature
Returns
500 - Missing environment variables or processing error