diff --git a/packages/twenty-server/src/engine/core-modules/billing/services/billing-portal.workspace-service.ts b/packages/twenty-server/src/engine/core-modules/billing/services/billing-portal.workspace-service.ts index d899763e7ec..acfbdee7eb2 100644 --- a/packages/twenty-server/src/engine/core-modules/billing/services/billing-portal.workspace-service.ts +++ b/packages/twenty-server/src/engine/core-modules/billing/services/billing-portal.workspace-service.ts @@ -101,6 +101,8 @@ export class BillingPortalWorkspaceService { stripeCustomerId: customer?.stripeCustomerId, plan, requirePaymentMethod, + withTrialPeriod: + !isDefined(customer) || customer.billingSubscriptions.length === 0, }); const createdBillingSubscription = diff --git a/packages/twenty-server/src/engine/core-modules/billing/stripe/services/stripe-checkout.service.ts b/packages/twenty-server/src/engine/core-modules/billing/stripe/services/stripe-checkout.service.ts index bce91a6ae91..41066f39cd8 100644 --- a/packages/twenty-server/src/engine/core-modules/billing/stripe/services/stripe-checkout.service.ts +++ b/packages/twenty-server/src/engine/core-modules/billing/stripe/services/stripe-checkout.service.ts @@ -95,6 +95,7 @@ export class StripeCheckoutService { stripeCustomerId, plan = BillingPlanKey.PRO, requirePaymentMethod = false, + withTrialPeriod, }: { user: User; workspace: Pick; @@ -102,6 +103,7 @@ export class StripeCheckoutService { stripeCustomerId?: string; plan?: BillingPlanKey; requirePaymentMethod?: boolean; + withTrialPeriod: boolean; }): Promise { if (!isDefined(stripeCustomerId)) { const stripeCustomer = @@ -128,6 +130,10 @@ export class StripeCheckoutService { workspaceId: workspace.id, plan, }, + ...this.getStripeSubscriptionTrialPeriodConfig( + withTrialPeriod, + requirePaymentMethod, + ), automatic_tax: { enabled: !!requirePaymentMethod }, };