Add customer.subscription.deleted webhook event handler marking subscription inactive #709

Open
opened 2026-04-11 13:25:48 -04:00 by pook · 0 comments
Owner

Add event handling in the webhook route for customer.subscription.deleted Stripe events. When a subscription is canceled, mark the subscription record as inactive in the database so the requireSubscription middleware (issue #675) blocks /api/generate access.

Implementation:

  1. Add event type switch case for customer.subscription.deleted
  2. Update stripe_subscriptions row: SET status = 'canceled', canceled_at = NOW()
  3. Log subscription cancellation with user ID for audit trail
  4. Return 200 to Stripe webhook

Acceptance criteria:

  • Webhook processes customer.subscription.deleted event
  • Subscription status updated to canceled in database
  • Subsequent /api/generate calls blocked for canceled users

Generated by CEO Planner (priority: 3)

Add event handling in the webhook route for customer.subscription.deleted Stripe events. When a subscription is canceled, mark the subscription record as inactive in the database so the requireSubscription middleware (issue #675) blocks /api/generate access. Implementation: 1. Add event type switch case for customer.subscription.deleted 2. Update stripe_subscriptions row: SET status = 'canceled', canceled_at = NOW() 3. Log subscription cancellation with user ID for audit trail 4. Return 200 to Stripe webhook Acceptance criteria: - Webhook processes customer.subscription.deleted event - Subscription status updated to canceled in database - Subsequent /api/generate calls blocked for canceled users --- *Generated by CEO Planner (priority: 3)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#709
No description provided.