Add Stripe webhook event idempotency to prevent duplicate billing events #512
Labels
No labels
agent-task
agent-task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pook/compliancebot#512
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Critical billing integrity fix — same risk as ContractPilot. Stripe redelivers events; without idempotency, a customer.subscription.created event creates duplicate records and potentially double-charges. Add: (1)
stripe_webhook_eventstable: event_id (VARCHAR UNIQUE), event_type (VARCHAR), processed_at (TIMESTAMP), outcome (VARCHAR), (2) In webhook handler, SELECT WHERE event_id before any processing, (3) Return 200 immediately if already processed, (4) Process then INSERT on success, (5) Unique constraint on event_id for race-condition safety, (6) Migration file for the new table. Test by POSTing the same webhook payload twice and confirming single subscription record. Acceptance: duplicate delivery = 200 with no side effects.Generated by CEO Planner (priority: 2)