fix(kilo-pass): void collectible Stripe invoices on cancel - #5409
Merged
eshurakov merged 4 commits intoAug 21, 2026
Conversation
Canceling Kilo Pass only set cancel_at_period_end, so Stripe kept retrying failed or pending invoices. Void open invoices and delete drafts after scheduling cancellation so collection stops.
Instead of deleting draft invoices, which may not be the preferred way to handle abandoned subscriptions in Stripe, this change updates draft invoices to disable `auto_advance`, finalizes them, and then voids them. This ensures a more controlled lifecycle for collectible invoices during the cancellation process. - Update `abandonCollectibleInvoicesForStripeSubscription` to use `finalizeDraftThenVoid` for draft invoices - Replace `stripe.invoices.del` with a sequence of `update`, `finalizeInvoice`, and `voidInvoice` - Update tests to reflect the new invoice handling logic and mock the new Stripe method calls
Keep the Stripe invoice helper aligned with the id/status fields it reads so unit mocks typecheck without full Invoice fixtures.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (4 files)
Previous Review Summary (commit 112d8bc)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 112d8bc)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (4 files)
Reviewed by grok-4.6 · Input: 183K · Output: 7.1K · Cached: 101.6K Review guidance: REVIEW.md from base branch |
Finalizing subscription drafts can advance current_period_end before cancel_at_period_end is set. Disable auto_advance on drafts instead.
intentionally-left-nil
approved these changes
Aug 20, 2026
eshurakov
deleted the
session/agent_d2484b89-3d25-4b3a-9e33-8f83243722bb
branch
August 21, 2026 08:09
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.
Summary
Canceling Kilo Pass only set
cancel_at_period_end, so Stripe kept retrying failed or pending invoices. This stops collection by abandoning collectible invoices before scheduling cancellation.auto_advance, finalize, then void (instead of deleting drafts)Test plan
oxlinton the four changed kilo-pass filespnpm typecheck --changes-onlypnpm --filter web test -- src/lib/kilo-pass/abandon-collectible-invoices.test.ts src/routers/kilo-pass-router.test.ts(139 passed)