From a7b75c61e877eee2ca2bc71aedd8a01b88b499b3 Mon Sep 17 00:00:00 2001 From: Etienne <45695613+etiennejouan@users.noreply.github.com> Date: Thu, 17 Apr 2025 16:23:03 +0200 Subject: [PATCH] fix billing command - add workflow subscription item (#11631) to migrate user with trialing or paused subscription status with trial end behaviour 'paused' --- .../billing-add-workflow-subscription-item.command.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/twenty-server/src/engine/core-modules/billing/commands/billing-add-workflow-subscription-item.command.ts b/packages/twenty-server/src/engine/core-modules/billing/commands/billing-add-workflow-subscription-item.command.ts index bb2cb01a9..d1ba96112 100644 --- a/packages/twenty-server/src/engine/core-modules/billing/commands/billing-add-workflow-subscription-item.command.ts +++ b/packages/twenty-server/src/engine/core-modules/billing/commands/billing-add-workflow-subscription-item.command.ts @@ -81,6 +81,17 @@ export class BillingAddWorkflowSubscriptionItemCommand extends ActiveOrSuspended } if (!options.dryRun) { + await this.stripeSubscriptionService.updateSubscription( + subscription.stripeSubscriptionId, + { + trial_settings: { + end_behavior: { + missing_payment_method: 'create_invoice', + }, + }, + }, + ); + await this.stripeSubscriptionItemService.createSubscriptionItem( subscription.stripeSubscriptionId, associatedWorkflowMeteredPrice.stripePriceId,