Add user_id metadata to Stripe checkout session for webhook correlation #1419

Open
opened 2026-04-13 18:35:33 -04:00 by pook · 0 comments
Owner

Issue #1400 adds checkout.session.completed handler. It needs to identify which user to provision — without metadata in the session, there's no user link.

  1. In POST /api/billing/checkout: add metadata { user_id: authenticatedUserId, product_tier: 'pro' } to session creation params
  2. In webhook handler (#1400): extract userId from event.data.object.metadata.user_id
  3. Use userId to INSERT into stripe_customers and stripe_subscriptions
  4. Tests: session created with correct metadata, webhook extracts metadata

Acceptance criteria:

  • Checkout session metadata contains user_id
  • Webhook handler reads user_id from metadata
  • Tests verify creation and extraction

Generated by CEO Planner (priority: 2)

Issue #1400 adds checkout.session.completed handler. It needs to identify which user to provision — without metadata in the session, there's no user link. 1. In POST /api/billing/checkout: add metadata { user_id: authenticatedUserId, product_tier: 'pro' } to session creation params 2. In webhook handler (#1400): extract userId from event.data.object.metadata.user_id 3. Use userId to INSERT into stripe_customers and stripe_subscriptions 4. Tests: session created with correct metadata, webhook extracts metadata Acceptance criteria: - Checkout session metadata contains user_id - Webhook handler reads user_id from metadata - Tests verify creation and extraction --- *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#1419
No description provided.