Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/good-buckets-cry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@clerk/clerk-js': minor
'@clerk/types': minor
---

[Billing Beta]: Dropping `paymentMethodId` from subscription item.
2 changes: 0 additions & 2 deletions packages/clerk-js/src/core/resources/BillingSubscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export class BillingSubscription extends BaseResource implements BillingSubscrip

export class BillingSubscriptionItem extends BaseResource implements BillingSubscriptionItemResource {
id!: string;
paymentMethodId!: string;
plan!: BillingPlan;
planPeriod!: BillingSubscriptionPlanPeriod;
status!: BillingSubscriptionStatus;
Expand All @@ -87,7 +86,6 @@ export class BillingSubscriptionItem extends BaseResource implements BillingSubs
}

this.id = data.id;
this.paymentMethodId = data.payment_method_id;
this.plan = new BillingPlan(data.plan);
this.planPeriod = data.plan_period;
this.status = data.status;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ describe('PricingTable - trial info', () => {
id: 'si_1',
plan: trialPlan,
createdAt: new Date('2021-01-01'),
paymentMethodId: 'src_1',
pastDueAt: null,
canceledAt: null,
periodStart: new Date('2021-01-01'),
Expand Down Expand Up @@ -213,7 +212,6 @@ describe('PricingTable - trial info', () => {
id: 'si_1',
plan: nonTrialPlan,
createdAt: new Date('2021-01-01'),
paymentMethodId: 'src_1',
pastDueAt: null,
canceledAt: null,
periodStart: new Date('2021-02-01'),
Expand Down Expand Up @@ -332,7 +330,6 @@ describe('PricingTable - plans visibility', () => {
id: 'si_active',
plan: testPlan,
createdAt: new Date('2021-01-01'),
paymentMethodId: 'src_1',
pastDueAt: null,
canceledAt: null,
periodStart: new Date('2021-01-01'),
Expand Down Expand Up @@ -458,7 +455,6 @@ describe('PricingTable - plans visibility', () => {
id: 'si_active',
plan: testPlan,
createdAt: new Date('2021-01-01'),
paymentMethodId: 'src_1',
pastDueAt: null,
canceledAt: null,
periodStart: new Date('2021-01-01'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const makeSub = (overrides: Partial<BillingSubscriptionItemResource>): BillingSu
planPeriod: 'month',
status: 'active',
createdAt: new Date('2021-01-01'),
paymentMethodId: 'src_1',
pastDueAt: null,
periodStart: new Date('2021-01-01'),
periodEnd: new Date('2021-01-31'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ describe('SubscriptionDetails', () => {
periodStart: new Date('2021-01-01'),
periodEnd: new Date('2021-02-01'),
canceledAt: null,
paymentMethodId: 'src_123',
planPeriod: 'month',
status: 'active',
},
Expand Down Expand Up @@ -189,7 +188,6 @@ describe('SubscriptionDetails', () => {
periodStart: new Date('2021-01-01'),
periodEnd: new Date('2022-01-01'),
canceledAt: null,
paymentMethodId: 'src_123',
planPeriod: 'annual' as const,
status: 'active' as const,
},
Expand Down Expand Up @@ -285,7 +283,6 @@ describe('SubscriptionDetails', () => {
periodStart: new Date('2021-01-01'),
periodEnd: new Date('2021-02-01'),
canceledAt: null,
paymentMethodId: 'src_123',
planPeriod: 'month' as const,
status: 'active' as const,
},
Expand Down Expand Up @@ -414,7 +411,6 @@ describe('SubscriptionDetails', () => {
periodStart: new Date('2021-01-01'),
periodEnd: new Date('2022-01-01'),
canceledAt: new Date('2021-04-01'),
paymentMethodId: 'src_annual',
planPeriod: 'annual' as const,
status: 'active' as const,
},
Expand All @@ -425,7 +421,6 @@ describe('SubscriptionDetails', () => {
periodStart: new Date('2022-02-01'),
periodEnd: new Date('2022-03-01'),
canceledAt: null,
paymentMethodId: 'src_monthly',
planPeriod: 'month' as const,
status: 'upcoming' as const,
},
Expand Down Expand Up @@ -568,7 +563,6 @@ describe('SubscriptionDetails', () => {
periodStart: new Date('2021-01-01'),
periodEnd: new Date('2021-02-01'),
canceledAt: new Date('2021-01-03'),
paymentMethodId: 'src_free_active',
planPeriod: 'month' as const,
status: 'active' as const,
},
Expand All @@ -578,7 +572,6 @@ describe('SubscriptionDetails', () => {
createdAt: new Date('2021-01-03'),
periodStart: new Date('2021-02-01'),
canceledAt: null,
paymentMethodId: 'src_free_upcoming',
planPeriod: 'month' as const,
status: 'upcoming' as const,
},
Expand Down Expand Up @@ -675,7 +668,6 @@ describe('SubscriptionDetails', () => {
periodStart: new Date('2021-01-01'),
periodEnd: new Date('2021-02-01'),
canceledAt: null,
paymentMethodId: 'src_123',
planPeriod: 'month' as const,
status: 'active' as const,
cancel: cancelSubscriptionMock,
Expand Down Expand Up @@ -774,7 +766,6 @@ describe('SubscriptionDetails', () => {
periodStart: new Date('2021-01-01'),
periodEnd: new Date('2022-01-01'),
canceledAt: new Date('2021-04-01'),
paymentMethodId: 'src_annual',
planPeriod: 'annual' as const,
status: 'active' as const,
cancel: vi.fn(),
Expand Down Expand Up @@ -875,7 +866,6 @@ describe('SubscriptionDetails', () => {
periodStart: new Date('2021-01-01'),
periodEnd: new Date('2022-01-01'),
canceledAt: null,
paymentMethodId: 'src_annual',
planPeriod: 'annual' as const,
status: 'active' as const,
cancel: vi.fn(),
Expand Down Expand Up @@ -993,7 +983,6 @@ describe('SubscriptionDetails', () => {
periodStart: new Date('2021-01-01'),
periodEnd: new Date('2021-02-01'),
canceledAt: null,
paymentMethodId: 'src_123',
planPeriod: 'month' as const,
status: 'past_due' as const,
pastDueAt: new Date('2021-01-15'),
Expand Down Expand Up @@ -1077,7 +1066,6 @@ describe('SubscriptionDetails', () => {
periodStart: new Date('2021-01-01'),
periodEnd: new Date('2021-02-01'),
canceledAt: null,
paymentMethodId: 'src_123',
planPeriod: 'month',
status: 'active',
isFreeTrial: true,
Expand Down Expand Up @@ -1188,7 +1176,6 @@ describe('SubscriptionDetails', () => {
periodStart: new Date('2021-01-01'),
periodEnd: new Date('2021-02-01'),
canceledAt: null,
paymentMethodId: 'src_123',
planPeriod: 'month',
status: 'active',
isFreeTrial: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ describe('SubscriptionsList', () => {
periodStart: new Date('2021-01-01'),
periodEnd: new Date('2021-01-15'),
canceledAt: null,
paymentMethodId: 'src_free',
planPeriod: 'month' as const,
isFreeTrial: false,
pastDueAt: null,
Expand Down Expand Up @@ -156,7 +155,6 @@ describe('SubscriptionsList', () => {
periodStart: new Date('2021-01-01'),
periodEnd: new Date('2021-01-15'),
canceledAt: null,
paymentMethodId: 'src_trial',
planPeriod: 'month' as const,
status: 'active' as const,
isFreeTrial: true, // This subscription is in a free trial
Expand Down Expand Up @@ -220,7 +218,6 @@ describe('SubscriptionsList', () => {
periodStart: new Date('2021-01-01'),
periodEnd: new Date('2021-02-01'),
canceledAt: null,
paymentMethodId: 'src_past_due',
planPeriod: 'month' as const,
status: 'past_due' as const,
isFreeTrial: false,
Expand Down Expand Up @@ -285,7 +282,6 @@ describe('SubscriptionsList', () => {
periodStart: new Date('2021-01-01'),
periodEnd: new Date('2021-02-01'),
canceledAt: null,
paymentMethodId: 'src_active',
planPeriod: 'month' as const,
status: 'active' as const,
isFreeTrial: false,
Expand Down Expand Up @@ -349,7 +345,6 @@ describe('SubscriptionsList', () => {
periodStart: new Date('2021-02-01'),
periodEnd: new Date('2021-03-01'),
canceledAt: null,
paymentMethodId: 'src_upcoming',
planPeriod: 'month' as const,
status: 'upcoming' as const,
isFreeTrial: false,
Expand Down Expand Up @@ -385,7 +380,6 @@ describe('SubscriptionsList', () => {
periodStart: new Date('2021-01-01'),
periodEnd: new Date('2021-02-01'),
canceledAt: new Date('2021-01-15'),
paymentMethodId: 'src_active_canceled',
planPeriod: 'month' as const,
status: 'active' as const,
isFreeTrial: false,
Expand Down
5 changes: 0 additions & 5 deletions packages/types/src/billing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -491,11 +491,6 @@ export interface BillingSubscriptionItemResource extends ClerkResource {
* The unique identifier for the subscription item.
*/
id: string;
/**
* The unique identifier for the payment method being used for the subscription item.
*/
//TODO(@COMMERCE): should this be nullable ?
paymentMethodId: string;
/**
* The plan associated with the subscription item.
*/
Expand Down
1 change: 0 additions & 1 deletion packages/types/src/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,6 @@ export interface BillingSubscriptionItemJSON extends ClerkResourceJSON {
credit?: {
amount: BillingMoneyAmountJSON;
};
payment_method_id: string;
plan: BillingPlanJSON;
plan_period: BillingSubscriptionPlanPeriod;
status: BillingSubscriptionStatus;
Expand Down
Loading