diff --git a/.changeset/silly-rooms-sleep.md b/.changeset/silly-rooms-sleep.md new file mode 100644 index 00000000000..d217e19ef8d --- /dev/null +++ b/.changeset/silly-rooms-sleep.md @@ -0,0 +1,5 @@ +--- +'@clerk/backend': minor +--- + +[Billing Beta] Update subscription item `plan` and `planId` properties to be `null`. diff --git a/packages/backend/src/api/resources/CommerceSubscriptionItem.ts b/packages/backend/src/api/resources/CommerceSubscriptionItem.ts index 081737fd033..38891fcf5a6 100644 --- a/packages/backend/src/api/resources/CommerceSubscriptionItem.ts +++ b/packages/backend/src/api/resources/CommerceSubscriptionItem.ts @@ -46,11 +46,11 @@ export class BillingSubscriptionItem { /** * The plan associated with this subscription item. */ - readonly plan: BillingPlan, + readonly plan: BillingPlan | null, /** * The plan ID. */ - readonly planId: string, + readonly planId: string | null, /** * Unix timestamp (milliseconds) of when the subscription item was created. */ @@ -112,8 +112,8 @@ export class BillingSubscriptionItem { data.period_start, data.next_payment, formatAmountJSON(data.amount), - BillingPlan.fromJSON(data.plan), - data.plan_id, + data.plan ? BillingPlan.fromJSON(data.plan) : null, + data.plan_id ?? null, data.created_at, data.updated_at, data.period_end, diff --git a/packages/backend/src/api/resources/JSON.ts b/packages/backend/src/api/resources/JSON.ts index 8bef448909c..dd28c67a1a3 100644 --- a/packages/backend/src/api/resources/JSON.ts +++ b/packages/backend/src/api/resources/JSON.ts @@ -880,8 +880,8 @@ export interface BillingSubscriptionItemJSON extends ClerkResourceJSON { date: number; } | null; amount: BillingMoneyAmountJSON | null; - plan: BillingPlanJSON; - plan_id: string; + plan?: BillingPlanJSON | null; + plan_id?: string | null; } /** @@ -906,7 +906,7 @@ export interface BillingSubscriptionItemWebhookEventJSON extends ClerkResourceJS next_payment_amount: number; next_payment_date: number; amount: BillingMoneyAmountJSON; - plan: { + plan?: { id: string; instance_id: string; product_id: string; @@ -922,8 +922,8 @@ export interface BillingSubscriptionItemWebhookEventJSON extends ClerkResourceJS currency: string; annual_monthly_amount: number; publicly_visible: boolean; - }; - plan_id: string; + } | null; + plan_id?: string | null; } /**