We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f23f122 commit 919a856Copy full SHA for 919a856
packages/billing/src/subscription-webhooks.ts
@@ -505,9 +505,14 @@ export async function handleSubscriptionScheduleReleasedOrCanceled(params: {
505
}): Promise<void> {
506
const { schedule, logger } = params
507
508
+ // When a schedule is released, the subscription field becomes null and
509
+ // the subscription ID moves to released_subscription. When canceled,
510
+ // the subscription field is retained. Check both fields.
511
const subscriptionId = schedule.subscription
512
? getStripeId(schedule.subscription)
- : null
513
+ : schedule.released_subscription
514
+ ? getStripeId(schedule.released_subscription)
515
+ : null
516
517
if (!subscriptionId) {
518
logger.debug(
0 commit comments