Skip to content

Commit a172d51

Browse files
authored
chore(clerk-js,types): Remove paymentMethodId from subscription item (#7017)
1 parent 947d0f5 commit a172d51

File tree

8 files changed

+6
-32
lines changed

8 files changed

+6
-32
lines changed

.changeset/good-buckets-cry.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@clerk/clerk-js': minor
3+
'@clerk/types': minor
4+
---
5+
6+
[Billing Beta]: Dropping `paymentMethodId` from subscription item.

packages/clerk-js/src/core/resources/BillingSubscription.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ export class BillingSubscription extends BaseResource implements BillingSubscrip
6060

6161
export class BillingSubscriptionItem extends BaseResource implements BillingSubscriptionItemResource {
6262
id!: string;
63-
paymentMethodId!: string;
6463
plan!: BillingPlan;
6564
planPeriod!: BillingSubscriptionPlanPeriod;
6665
status!: BillingSubscriptionStatus;
@@ -87,7 +86,6 @@ export class BillingSubscriptionItem extends BaseResource implements BillingSubs
8786
}
8887

8988
this.id = data.id;
90-
this.paymentMethodId = data.payment_method_id;
9189
this.plan = new BillingPlan(data.plan);
9290
this.planPeriod = data.plan_period;
9391
this.status = data.status;

packages/clerk-js/src/ui/components/PricingTable/__tests__/PricingTable.test.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ describe('PricingTable - trial info', () => {
6868
id: 'si_1',
6969
plan: trialPlan,
7070
createdAt: new Date('2021-01-01'),
71-
paymentMethodId: 'src_1',
7271
pastDueAt: null,
7372
canceledAt: null,
7473
periodStart: new Date('2021-01-01'),
@@ -213,7 +212,6 @@ describe('PricingTable - trial info', () => {
213212
id: 'si_1',
214213
plan: nonTrialPlan,
215214
createdAt: new Date('2021-01-01'),
216-
paymentMethodId: 'src_1',
217215
pastDueAt: null,
218216
canceledAt: null,
219217
periodStart: new Date('2021-02-01'),
@@ -332,7 +330,6 @@ describe('PricingTable - plans visibility', () => {
332330
id: 'si_active',
333331
plan: testPlan,
334332
createdAt: new Date('2021-01-01'),
335-
paymentMethodId: 'src_1',
336333
pastDueAt: null,
337334
canceledAt: null,
338335
periodStart: new Date('2021-01-01'),
@@ -458,7 +455,6 @@ describe('PricingTable - plans visibility', () => {
458455
id: 'si_active',
459456
plan: testPlan,
460457
createdAt: new Date('2021-01-01'),
461-
paymentMethodId: 'src_1',
462458
pastDueAt: null,
463459
canceledAt: null,
464460
periodStart: new Date('2021-01-01'),

packages/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ const makeSub = (overrides: Partial<BillingSubscriptionItemResource>): BillingSu
3030
planPeriod: 'month',
3131
status: 'active',
3232
createdAt: new Date('2021-01-01'),
33-
paymentMethodId: 'src_1',
3433
pastDueAt: null,
3534
periodStart: new Date('2021-01-01'),
3635
periodEnd: new Date('2021-01-31'),

packages/clerk-js/src/ui/components/SubscriptionDetails/__tests__/SubscriptionDetails.test.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ describe('SubscriptionDetails', () => {
8585
periodStart: new Date('2021-01-01'),
8686
periodEnd: new Date('2021-02-01'),
8787
canceledAt: null,
88-
paymentMethodId: 'src_123',
8988
planPeriod: 'month',
9089
status: 'active',
9190
},
@@ -189,7 +188,6 @@ describe('SubscriptionDetails', () => {
189188
periodStart: new Date('2021-01-01'),
190189
periodEnd: new Date('2022-01-01'),
191190
canceledAt: null,
192-
paymentMethodId: 'src_123',
193191
planPeriod: 'annual' as const,
194192
status: 'active' as const,
195193
},
@@ -285,7 +283,6 @@ describe('SubscriptionDetails', () => {
285283
periodStart: new Date('2021-01-01'),
286284
periodEnd: new Date('2021-02-01'),
287285
canceledAt: null,
288-
paymentMethodId: 'src_123',
289286
planPeriod: 'month' as const,
290287
status: 'active' as const,
291288
},
@@ -414,7 +411,6 @@ describe('SubscriptionDetails', () => {
414411
periodStart: new Date('2021-01-01'),
415412
periodEnd: new Date('2022-01-01'),
416413
canceledAt: new Date('2021-04-01'),
417-
paymentMethodId: 'src_annual',
418414
planPeriod: 'annual' as const,
419415
status: 'active' as const,
420416
},
@@ -425,7 +421,6 @@ describe('SubscriptionDetails', () => {
425421
periodStart: new Date('2022-02-01'),
426422
periodEnd: new Date('2022-03-01'),
427423
canceledAt: null,
428-
paymentMethodId: 'src_monthly',
429424
planPeriod: 'month' as const,
430425
status: 'upcoming' as const,
431426
},
@@ -568,7 +563,6 @@ describe('SubscriptionDetails', () => {
568563
periodStart: new Date('2021-01-01'),
569564
periodEnd: new Date('2021-02-01'),
570565
canceledAt: new Date('2021-01-03'),
571-
paymentMethodId: 'src_free_active',
572566
planPeriod: 'month' as const,
573567
status: 'active' as const,
574568
},
@@ -578,7 +572,6 @@ describe('SubscriptionDetails', () => {
578572
createdAt: new Date('2021-01-03'),
579573
periodStart: new Date('2021-02-01'),
580574
canceledAt: null,
581-
paymentMethodId: 'src_free_upcoming',
582575
planPeriod: 'month' as const,
583576
status: 'upcoming' as const,
584577
},
@@ -675,7 +668,6 @@ describe('SubscriptionDetails', () => {
675668
periodStart: new Date('2021-01-01'),
676669
periodEnd: new Date('2021-02-01'),
677670
canceledAt: null,
678-
paymentMethodId: 'src_123',
679671
planPeriod: 'month' as const,
680672
status: 'active' as const,
681673
cancel: cancelSubscriptionMock,
@@ -774,7 +766,6 @@ describe('SubscriptionDetails', () => {
774766
periodStart: new Date('2021-01-01'),
775767
periodEnd: new Date('2022-01-01'),
776768
canceledAt: new Date('2021-04-01'),
777-
paymentMethodId: 'src_annual',
778769
planPeriod: 'annual' as const,
779770
status: 'active' as const,
780771
cancel: vi.fn(),
@@ -875,7 +866,6 @@ describe('SubscriptionDetails', () => {
875866
periodStart: new Date('2021-01-01'),
876867
periodEnd: new Date('2022-01-01'),
877868
canceledAt: null,
878-
paymentMethodId: 'src_annual',
879869
planPeriod: 'annual' as const,
880870
status: 'active' as const,
881871
cancel: vi.fn(),
@@ -993,7 +983,6 @@ describe('SubscriptionDetails', () => {
993983
periodStart: new Date('2021-01-01'),
994984
periodEnd: new Date('2021-02-01'),
995985
canceledAt: null,
996-
paymentMethodId: 'src_123',
997986
planPeriod: 'month' as const,
998987
status: 'past_due' as const,
999988
pastDueAt: new Date('2021-01-15'),
@@ -1077,7 +1066,6 @@ describe('SubscriptionDetails', () => {
10771066
periodStart: new Date('2021-01-01'),
10781067
periodEnd: new Date('2021-02-01'),
10791068
canceledAt: null,
1080-
paymentMethodId: 'src_123',
10811069
planPeriod: 'month',
10821070
status: 'active',
10831071
isFreeTrial: true,
@@ -1188,7 +1176,6 @@ describe('SubscriptionDetails', () => {
11881176
periodStart: new Date('2021-01-01'),
11891177
periodEnd: new Date('2021-02-01'),
11901178
canceledAt: null,
1191-
paymentMethodId: 'src_123',
11921179
planPeriod: 'month',
11931180
status: 'active',
11941181
isFreeTrial: true,

packages/clerk-js/src/ui/components/Subscriptions/__tests__/SubscriptionsList.test.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ describe('SubscriptionsList', () => {
9191
periodStart: new Date('2021-01-01'),
9292
periodEnd: new Date('2021-01-15'),
9393
canceledAt: null,
94-
paymentMethodId: 'src_free',
9594
planPeriod: 'month' as const,
9695
isFreeTrial: false,
9796
pastDueAt: null,
@@ -156,7 +155,6 @@ describe('SubscriptionsList', () => {
156155
periodStart: new Date('2021-01-01'),
157156
periodEnd: new Date('2021-01-15'),
158157
canceledAt: null,
159-
paymentMethodId: 'src_trial',
160158
planPeriod: 'month' as const,
161159
status: 'active' as const,
162160
isFreeTrial: true, // This subscription is in a free trial
@@ -220,7 +218,6 @@ describe('SubscriptionsList', () => {
220218
periodStart: new Date('2021-01-01'),
221219
periodEnd: new Date('2021-02-01'),
222220
canceledAt: null,
223-
paymentMethodId: 'src_past_due',
224221
planPeriod: 'month' as const,
225222
status: 'past_due' as const,
226223
isFreeTrial: false,
@@ -285,7 +282,6 @@ describe('SubscriptionsList', () => {
285282
periodStart: new Date('2021-01-01'),
286283
periodEnd: new Date('2021-02-01'),
287284
canceledAt: null,
288-
paymentMethodId: 'src_active',
289285
planPeriod: 'month' as const,
290286
status: 'active' as const,
291287
isFreeTrial: false,
@@ -349,7 +345,6 @@ describe('SubscriptionsList', () => {
349345
periodStart: new Date('2021-02-01'),
350346
periodEnd: new Date('2021-03-01'),
351347
canceledAt: null,
352-
paymentMethodId: 'src_upcoming',
353348
planPeriod: 'month' as const,
354349
status: 'upcoming' as const,
355350
isFreeTrial: false,
@@ -385,7 +380,6 @@ describe('SubscriptionsList', () => {
385380
periodStart: new Date('2021-01-01'),
386381
periodEnd: new Date('2021-02-01'),
387382
canceledAt: new Date('2021-01-15'),
388-
paymentMethodId: 'src_active_canceled',
389383
planPeriod: 'month' as const,
390384
status: 'active' as const,
391385
isFreeTrial: false,

packages/types/src/billing.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -491,11 +491,6 @@ export interface BillingSubscriptionItemResource extends ClerkResource {
491491
* The unique identifier for the subscription item.
492492
*/
493493
id: string;
494-
/**
495-
* The unique identifier for the payment method being used for the subscription item.
496-
*/
497-
//TODO(@COMMERCE): should this be nullable ?
498-
paymentMethodId: string;
499494
/**
500495
* The plan associated with the subscription item.
501496
*/

packages/types/src/json.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,6 @@ export interface BillingSubscriptionItemJSON extends ClerkResourceJSON {
730730
credit?: {
731731
amount: BillingMoneyAmountJSON;
732732
};
733-
payment_method_id: string;
734733
plan: BillingPlanJSON;
735734
plan_period: BillingSubscriptionPlanPeriod;
736735
status: BillingSubscriptionStatus;

0 commit comments

Comments
 (0)