Add Stripe webhook event idempotency using event ID as dedup key #1239

Open
opened 2026-04-13 08:25:16 -04:00 by pook · 0 comments
Owner

Webhook handlers (PR #776 for customer.subscription events) will be called multiple times by Stripe for the same event. Add a helper in src/billing/idempotency.ts that: (1) takes a Stripe event ID, (2) checks a billing_events table (or stripe_webhook_events if it exists) for prior processing, (3) if already processed, returns the stored result and skips handler execution, (4) if new, marks it as processing, runs the handler, then marks complete. Acceptance: calling the helper twice with the same event ID executes the handler only once.


Generated by CEO Planner (priority: 2)

Webhook handlers (PR #776 for customer.subscription events) will be called multiple times by Stripe for the same event. Add a helper in src/billing/idempotency.ts that: (1) takes a Stripe event ID, (2) checks a billing_events table (or stripe_webhook_events if it exists) for prior processing, (3) if already processed, returns the stored result and skips handler execution, (4) if new, marks it as processing, runs the handler, then marks complete. Acceptance: calling the helper twice with the same event ID executes the handler only once. --- *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#1239
No description provided.