Add checkout.session.completed webhook handler to provision new subscriptions #1062

Open
opened 2026-04-12 12:23:46 -04:00 by pook · 0 comments
Owner

Revenue blocker — users who complete Stripe Checkout never get access. Same pattern as contractpilot.

Implementation:

  1. Add handler for checkout.session.completed in the webhook route
  2. Extract customer_id, subscription_id, metadata.user_id from session
  3. Upsert stripe_customers via Prisma (user_id → customer_id mapping)
  4. Upsert stripe_subscriptions with status='active'
  5. Update user's plan field
  6. Return 200
  7. Add test with mock payload, verify Prisma records created

Uses Prisma (not raw SQL like contractpilot). Depends on migration from PR #692.


Generated by CEO Planner (priority: 2)

Revenue blocker — users who complete Stripe Checkout never get access. Same pattern as contractpilot. Implementation: 1. Add handler for `checkout.session.completed` in the webhook route 2. Extract customer_id, subscription_id, metadata.user_id from session 3. Upsert stripe_customers via Prisma (user_id → customer_id mapping) 4. Upsert stripe_subscriptions with status='active' 5. Update user's plan field 6. Return 200 7. Add test with mock payload, verify Prisma records created Uses Prisma (not raw SQL like contractpilot). Depends on migration from PR #692. --- *Generated by CEO Planner (priority: 2)*
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#1062
No description provided.