Stripe Webhook
Receives Stripe payment and subscription events.Authentication
Requires valid Stripe webhook signature in theStripe-Signature header. Signature is verified using the webhook secret configured in STRIPE_WEBHOOK_SECRET.
Headers
Stripe webhook signature. Generated by Stripe for each webhook delivery. Format:
t=<timestamp>,v1=<signature>Must be
application/jsonRequest Body
Stripe event object:Supported Events
Executor handles these Stripe event types:customer.subscription.created
New subscription created
customer.subscription.updated
Subscription modified (plan change, status change, etc.)
customer.subscription.deleted
Subscription canceled or expired
invoice.payment_succeeded
Successful payment for an invoice
invoice.payment_failed
Failed payment attempt
checkout.session.completed
Checkout session completed successfully
Response
Example Request
Error Responses
400 Bad Request
Invalid webhook signature or malformed payload
401 Unauthorized
Missing or invalid
Stripe-Signature headerConfiguration
Stripe webhook handling requires:Webhook signing secret from Stripe dashboard. Used to verify webhook authenticity.
Stripe secret API key for making API calls
Testing
Use Stripe CLI to test webhooks locally:WorkOS Webhooks
WorkOS AuthKit automatically registers webhook endpoints for authentication events.Registration
Webhook routes are registered via@convex-dev/workos-authkit:
- Webhook URL registration
- Signature verification
- Event parsing and routing
Supported Events
organization.created
New organization created in WorkOS
organization.updated
Organization details modified
organization.deleted
Organization removed from WorkOS
organization_membership.created
User added to organization
organization_membership.updated
Organization membership modified (role change, etc.)
organization_membership.deleted
User removed from organization
user.created
New user account created
user.updated
User profile updated
user.deleted
User account deleted
session.created
New user session started
Event Processing
WorkOS events are processed by handlers inexecutor/packages/database/src/auth/event_handlers.ts. Event processing:
- Signature Verification - AuthKit verifies the webhook signature using
WORKOS_WEBHOOK_SECRET - Event Routing - Events are routed to type-specific handlers
- Database Updates - Handlers update Convex database tables:
- Organizations →
organizationstable - Memberships →
organizationMemberstable - Users →
accountstable
- Organizations →
- Workspace Sync - Organization changes trigger workspace provisioning/updates
Configuration
WorkOS webhook handling requires:WorkOS application client ID
WorkOS API key for making API calls
Webhook signing secret from WorkOS dashboard
Webhook URLs
AuthKit registers webhook endpoints dynamically. Typical URL pattern:@convex-dev/workos-authkit package.
Testing
Test WorkOS webhooks using the WorkOS dashboard:- Navigate to Webhooks in WorkOS dashboard
- Add endpoint URL:
https://your-deployment.convex.site/auth/workos/webhook - Select event types to subscribe to
- Use Send test webhook to trigger events
Event Handler Implementation
Event handlers are configured inexecutor/packages/database/convex/auth.ts:7-41:
executor/packages/database/src/auth/event_handlers.ts.
Webhook Security
Signature Verification
All webhooks verify signatures before processing:Extract Signature
Parse signature from request headers:
- Stripe:
Stripe-Signatureheader - WorkOS: Verified by AuthKit middleware
Replay Protection
Webhooks include timestamp verification:- Stripe: Timestamp in signature (
t=component) must be within tolerance window - WorkOS: AuthKit handles replay protection automatically
IP Allowlisting
Consider restricting webhook endpoints to known service IPs:- Stripe IPs: https://stripe.com/docs/ips
- WorkOS IPs: Contact WorkOS support
Monitoring
Webhook Logs
Webhook processing logs are available in Convex dashboard under Logs → Functions. Filter by:- Stripe: Search for
stripe/webhook - WorkOS: Search for
authKitorworkos
Failed Deliveries
Check service dashboards for delivery failures:- Stripe: Dashboard → Developers → Webhooks → View logs
- WorkOS: Dashboard → Webhooks → Event log
Retry Behavior
- Stripe: Automatic retries with exponential backoff (up to 3 days)
- WorkOS: Automatic retries with exponential backoff
Source Files
- Route registration:
executor/packages/database/convex/http.ts:14-17 - Stripe integration: Via
@convex-dev/stripepackage - WorkOS integration:
executor/packages/database/convex/auth.ts:1-54 - WorkOS event handlers:
executor/packages/database/src/auth/event_handlers.ts