Skip to content

fix(payment-gated-subs): Skip billing of missed periods after activation of incomplete subscriptions#5935

Open
osmarluz wants to merge 1 commit into
mainfrom
fix/skip-billing-of-missed-periods-after-activation-of-incomplete-subscriptions
Open

fix(payment-gated-subs): Skip billing of missed periods after activation of incomplete subscriptions#5935
osmarluz wants to merge 1 commit into
mainfrom
fix/skip-billing-of-missed-periods-after-activation-of-incomplete-subscriptions

Conversation

@osmarluz

@osmarluz osmarluz commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Context

When a payment-gated subscription stays incomplete past one or more billing boundaries, activation replayed every boundary crossed during the gating window (BillMissedPeriodsService): the customer who just approved the gating payment immediately received one full periodic invoice per elapsed period, paying for time the subscription was never active.

Description

BillMissedPeriodsService is replaced by BillCurrentPeriodService: on activation, only the period in progress is billed, with a single periodic invoice backdated to the period's boundary so the subscription seamlessly rejoins the regular billing clock. The service computes that boundary directly from the current time (using the monthly split grid for yearly and semiannual plans with monthly-billed charges or fixed charges) instead of walking every boundary since started_at. If activation happens within the first period, nothing is billed since the gating invoice already covered it.

Periods fully elapsed while gated are intentionally forgiven and never billed. A fixed-charge change deferred into a skipped period (#5925) still takes effect on the first billed invoice, because fixed-charge aggregation carries the last event preceding the billed window.

@osmarluz osmarluz requested a review from ancorcruz July 14, 2026 13:04
Comment thread app/jobs/subscriptions/activation_rules/bill_current_period_job.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants