+2
@@ -101,6 +101,8 @@ export class BillingPortalWorkspaceService {
|
||||
stripeCustomerId: customer?.stripeCustomerId,
|
||||
plan,
|
||||
requirePaymentMethod,
|
||||
withTrialPeriod:
|
||||
!isDefined(customer) || customer.billingSubscriptions.length === 0,
|
||||
});
|
||||
|
||||
const createdBillingSubscription =
|
||||
|
||||
+6
@@ -95,6 +95,7 @@ export class StripeCheckoutService {
|
||||
stripeCustomerId,
|
||||
plan = BillingPlanKey.PRO,
|
||||
requirePaymentMethod = false,
|
||||
withTrialPeriod,
|
||||
}: {
|
||||
user: User;
|
||||
workspace: Pick<Workspace, 'id' | 'displayName'>;
|
||||
@@ -102,6 +103,7 @@ export class StripeCheckoutService {
|
||||
stripeCustomerId?: string;
|
||||
plan?: BillingPlanKey;
|
||||
requirePaymentMethod?: boolean;
|
||||
withTrialPeriod: boolean;
|
||||
}): Promise<Stripe.Subscription> {
|
||||
if (!isDefined(stripeCustomerId)) {
|
||||
const stripeCustomer =
|
||||
@@ -128,6 +130,10 @@ export class StripeCheckoutService {
|
||||
workspaceId: workspace.id,
|
||||
plan,
|
||||
},
|
||||
...this.getStripeSubscriptionTrialPeriodConfig(
|
||||
withTrialPeriod,
|
||||
requirePaymentMethod,
|
||||
),
|
||||
automatic_tax: { enabled: !!requirePaymentMethod },
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user