fix(billing): reenable trial (#14616)

…reation
This commit is contained in:
Antoine Moreaux
2025-09-19 15:16:57 +02:00
committed by GitHub
parent 5311b07ae8
commit deed08ba25
2 changed files with 8 additions and 0 deletions
@@ -101,6 +101,8 @@ export class BillingPortalWorkspaceService {
stripeCustomerId: customer?.stripeCustomerId,
plan,
requirePaymentMethod,
withTrialPeriod:
!isDefined(customer) || customer.billingSubscriptions.length === 0,
});
const createdBillingSubscription =
@@ -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 },
};