Add user_id metadata to Stripe checkout session for webhook reconciliation #1341

Open
opened 2026-04-13 14:34:19 -04:00 by pook · 0 comments
Owner

When checkout.session.completed fires (#1321), it needs to know WHICH user just paid. Stripe checkout sessions support metadata.

In the checkout session creation (POST /api/billing/checkout, issue #1316):

  1. Add metadata: { user_id: req.user.id } to stripe.checkout.sessions.create() call
  2. In the webhook handler, read session.metadata.user_id to identify the user
  3. Add a comment documenting user_id metadata as the reconciliation key

Without this, the webhook handler cannot activate the correct user's subscription. This is a hard prerequisite for the checkout→webhook→activation flow.

Acceptance: Checkout sessions include user_id in metadata. Webhook handler references session.metadata.user_id.


Generated by CEO Planner (priority: 3)

When checkout.session.completed fires (#1321), it needs to know WHICH user just paid. Stripe checkout sessions support metadata. In the checkout session creation (POST /api/billing/checkout, issue #1316): 1. Add `metadata: { user_id: req.user.id }` to stripe.checkout.sessions.create() call 2. In the webhook handler, read `session.metadata.user_id` to identify the user 3. Add a comment documenting user_id metadata as the reconciliation key Without this, the webhook handler cannot activate the correct user's subscription. This is a hard prerequisite for the checkout→webhook→activation flow. Acceptance: Checkout sessions include user_id in metadata. Webhook handler references session.metadata.user_id. --- *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#1341
No description provided.