Skip to content

Commit a52d403

Browse files
committed
Improve stripe "phases" docs
1 parent c9b56fc commit a52d403

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/billing/src/subscription-webhooks.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,10 @@ export async function handleSubscriptionScheduleCreatedOrUpdated(params: {
414414
return
415415
}
416416

417-
// Need at least 2 phases to have a scheduled change (current + future)
417+
// Stripe subscription schedules use "phases" to represent timeline segments:
418+
// - Phase 0: The current subscription state (e.g., $200/month)
419+
// - Phase 1: The scheduled future state (e.g., $100/month after renewal)
420+
// We need at least 2 phases to have a pending change; 1 phase means no scheduled change.
418421
if (!schedule.phases || schedule.phases.length < 2) {
419422
logger.debug(
420423
{ scheduleId: schedule.id, subscriptionId, phases: schedule.phases?.length },
@@ -423,7 +426,7 @@ export async function handleSubscriptionScheduleCreatedOrUpdated(params: {
423426
return
424427
}
425428

426-
// Extract the scheduled tier from the next phase (phase 1)
429+
// Extract the scheduled tier from phase 1 (the upcoming change)
427430
const nextPhase = schedule.phases[1]
428431
const scheduledPriceId = nextPhase?.items?.[0]?.price
429432
const priceId = typeof scheduledPriceId === 'string'

0 commit comments

Comments
 (0)