Repository navigation
fix(billing): block a payer on every failed invoice payment - #10579
Conversation
A charge made outside Stripe's retry schedule, such as the one that ends an ineligible trial at once, fails with attempt_count 0. The handler only blocked from attempt 1, so the payer kept the plan's full allowance while past due. Block on any failure, and send the failure email on attempt 0 or 1.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
[Medium impact] The PR appears safe to merge; no blocking issues remain. SummaryBlocks personal payers and organization members on every failed invoice payment, including
Reviews (2) · Last reviewed commit: "fix(billing): hold a payment block while..." · Reviewed by Greptile |
There was a problem hiding this comment.
All reported issues were addressed across 2 files
This PR changes payment, billing, or quota logic. Ultrareviews find 2.4x more serious bugs than standard reviews. Comment @cubic-dev-ai ultrareview to run one.
Turn on auto-fix | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
handleInvoicePaymentFailedonly blocked the payer fromattempt_count >= 1. A charge Stripe makes outside its retry schedule, such as the one when a trial whose card already had a trial is ended at once, fails withattempt_count: 0, so the payer was never blocked and kept the plan's full allowance while past dueType of Change
Testing
lib/billing/webhooks/invoices.integration.ts(real Postgres): a failed invoice blocks its personal payer on attempt 1 and on attempt 0. The attempt-0 case fails on the pre-fix handler and passes with the fix; 5/5 greenlib/billing/webhooks/invoices.test.ts2/2; biome on the changed files; type-check, audits and the full suite in CIChecklist
test-auditauthoring gate)