feat(payments): payment + webhook flow#183
Merged
chitrank2050 merged 4 commits intoMay 22, 2026
Merged
Conversation
- PaymentIntentService: creates payment intents, schedules retries with backoff - WebhookController: POST /webhooks/stripe + /webhooks/fake endpoints - WebhookProcessingService: signature validation, deduplication, event routing - PaymentSuccessHandler: marks invoice PAID, creates ledger PAYMENT, advances period - PaymentFailureHandler: records failure, schedules retry, PAST_DUE after max retries - Webhook deduplication via UNIQUE provider_event_id constraint - Raw body parser enabled for Stripe signature validation - Schema: payment_attempts + webhook_events tables with indexes - Tested: success flow, failure flow, dedup — all passing
- InvoicesController.finalize() triggers PaymentIntentService after finalize - Fire-and-forget: response returns immediately, payment created async - Fixed duplicate finalize call bug (was calling finalize twice) - Tested: generate → finalize → payment auto-created with SUCCEEDED status
- Webhook → find attempt → update SUCCEEDED → markPaid → advancePeriod - Tested: INV-2026-0008 FINALIZED → PAID via webhook, ledger PAYMENT created - Tested: subscription period advanced Jul 20 → Aug 20 - Tested: idempotent — duplicate webhook skipped, no double-payment - advancePeriod wrapped in try/catch (non-critical, cron catches failures)
This was
linked to
issues
May 22, 2026
…Os for payment & webhook events
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🚀 Features