mirror of
https://github.com/AJaySi/ALwrity.git
synced 2026-04-25 08:55:58 +03:00
[PR #378] [MERGED] Persist Stripe webhook events and enforce idempotent processing #682
Labels
No labels
AI Content Agents
AI Content Strategy
AI Content planning
AI Marketing Tools
AI SEO
AI personalization
AI writer
ALwrity Copi-lot
Alwrity web search
Anthropic
DeepSeek
Gemini AI
Integration
LLM
OnBoarding
OnBoarding
RAG knowledgebase Memory
bug
documentation
enhancement
good first issue
help wanted
invalid
openai
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ALwrity#682
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?
📋 Pull Request Information
Original PR: https://github.com/AJaySi/ALwrity/pull/378
Author: @AJaySi
Created: 3/4/2026
Status: ✅ Merged
Merged: 3/5/2026
Merged by: @AJaySi
Base:
main← Head:codex/add-webhook-event-persistence-to-stripeservice📝 Commits (1)
c604dc8Add Stripe webhook event persistence and idempotency📊 Changes
2 files changed (+90 additions, -14 deletions)
View changed files
📝
backend/models/subscription_models.py(+16 -0)📝
backend/services/subscription/stripe_service.py(+74 -14)📄 Description
Motivation
event.idbefore applying subscription mutations to avoid double-processing on retries or concurrent deliveries.Description
ProcessedStripeEventmodel mapped to theprocessed_stripe_eventstable with fieldsevent_id,event_type,status,attempt_count,received_at,processing_started_at,processed_at,last_error, andupdated_at.StripeService.handle_webhookto requireevent.id, persist or update aProcessedStripeEventrecord intoprocessingstate before dispatching handlers, and short-circuit with success when the event is alreadyprocessed.processedand setprocessed_at; on exceptions, setfailedand capture a truncatedlast_errorfor observability and replay troubleshooting.IntegrityErrorhandling to avoid duplicate processing under concurrent deliveries.Testing
python -m py_compile backend/models/subscription_models.py backend/services/subscription/stripe_service.py, which completed successfully.Codex Task
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.