Skip to content

Commit d68a042

Browse files
committed
wip
1 parent 6aba342 commit d68a042

File tree

6 files changed

+9
-11
lines changed

6 files changed

+9
-11
lines changed

packages/clerk-js/src/core/modules/billing/namespace.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929

3030
export class Billing implements BillingNamespace {
3131
static readonly #pathRoot = '/billing';
32-
static path(subPath: string, param?: { orgId?: string }): string {
32+
static path(subPath: string, param?: { orgId?: string | null }): string {
3333
const { orgId } = param || {};
3434
const prefix = orgId ? `/organizations/${orgId}` : '/me';
3535
return `${prefix}${Billing.#pathRoot}${subPath}`;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class BillingPayment extends BaseResource implements BillingPaymentResour
1818
failedAt?: Date;
1919
paidAt?: Date;
2020
updatedAt!: Date;
21-
paymentMethod!: BillingPaymentMethodResource;
21+
paymentMethod: BillingPaymentMethodResource | null = null;
2222
subscriptionItem!: BillingSubscriptionItemResource;
2323
chargeType!: BillingPaymentChargeType;
2424
status!: BillingPaymentStatus;
@@ -38,7 +38,7 @@ export class BillingPayment extends BaseResource implements BillingPaymentResour
3838
this.paidAt = data.paid_at ? unixEpochToDate(data.paid_at) : undefined;
3939
this.failedAt = data.failed_at ? unixEpochToDate(data.failed_at) : undefined;
4040
this.updatedAt = unixEpochToDate(data.updated_at);
41-
this.paymentMethod = new BillingPaymentMethod(data.payment_method);
41+
this.paymentMethod = data.payment_method ? new BillingPaymentMethod(data.payment_method) : null;
4242
this.subscriptionItem = new BillingSubscriptionItem(data.subscription_item);
4343
this.chargeType = data.charge_type;
4444
this.status = data.status;

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/shared/src/types/billing.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ export interface BillingPaymentResource extends ClerkResource {
407407
/**
408408
* The payment method being used for the payment, such as credit card or bank account.
409409
*/
410-
paymentMethod: BillingPaymentMethodResource;
410+
paymentMethod: BillingPaymentMethodResource | null;
411411
/**
412412
* The subscription item being paid for.
413413
*/
@@ -506,11 +506,6 @@ export interface BillingSubscriptionItemResource extends ClerkResource {
506506
* The unique identifier for the subscription item.
507507
*/
508508
id: string;
509-
/**
510-
* The unique identifier for the payment method being used for the subscription item.
511-
*/
512-
//TODO(@COMMERCE): should this be nullable ?
513-
paymentMethodId: string;
514509
/**
515510
* The plan associated with the subscription item.
516511
*/
@@ -700,6 +695,7 @@ export interface BillingCheckoutTotals {
700695
*
701696
* @experimental This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change. It is advised to [pin](https://clerk.com/docs/pinning) the SDK version and the clerk-js version to avoid breaking changes.
702697
*/
698+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
703699
export interface BillingStatementTotals extends Omit<BillingCheckoutTotals, 'totalDueNow' | 'totalDueAfterFreeTrial'> {}
704700

705701
/**

packages/shared/src/types/json.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,10 @@ export interface ApiKeyJSON extends ClerkResourceJSON {
865865
expiration: number | null;
866866
created_by: string | null;
867867
description: string | null;
868+
/**
869+
* This property is only present in the response from `create()`.
870+
*/
871+
secret?: string;
868872
last_used_at: number | null;
869873
created_at: number;
870874
updated_at: number;

packages/types/src/json.ts

Whitespace-only changes.

0 commit comments

Comments
 (0)