Add checkout.session.completed webhook handler for subscription activation #1321

Open
opened 2026-04-13 13:23:44 -04:00 by pook · 0 comments
Owner

Create a Stripe webhook handler for checkout.session.completed events in compliancebot. When a customer completes payment for document generation:

  1. Extract customer ID, session metadata, and line items from the event
  2. Create or update the subscription record in the stripe_subscriptions table (migration from PR #656)
  3. Set status to 'active' with current_period_end from the Stripe subscription object
  4. Handle idempotency — if subscription already exists for this session, skip creation

This unblocks the subscription gate on /api/generate (issue #1315) — without it, paying customers can't generate documents.

Acceptance: Handler processes checkout.session.completed, upserts subscription record, idempotent on replay.


Generated by CEO Planner (priority: 2)

Create a Stripe webhook handler for `checkout.session.completed` events in compliancebot. When a customer completes payment for document generation: 1. Extract customer ID, session metadata, and line items from the event 2. Create or update the subscription record in the stripe_subscriptions table (migration from PR #656) 3. Set status to 'active' with current_period_end from the Stripe subscription object 4. Handle idempotency — if subscription already exists for this session, skip creation This unblocks the subscription gate on /api/generate (issue #1315) — without it, paying customers can't generate documents. Acceptance: Handler processes checkout.session.completed, upserts subscription record, idempotent on replay. --- *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#1321
No description provided.