From 1721875ab60cfe5da817c5b10d4ab265f4245ce8 Mon Sep 17 00:00:00 2001 From: liuyi Date: Tue, 10 Dec 2024 17:24:28 +0900 Subject: [PATCH] fix(server): minize checkout parameters (#9090) --- .../server/src/plugins/payment/manager/user.ts | 14 +++----------- .../src/plugins/payment/manager/workspace.ts | 12 +++--------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/packages/backend/server/src/plugins/payment/manager/user.ts b/packages/backend/server/src/plugins/payment/manager/user.ts index 3a1b0bc0c16cb..7df2e07c6da84 100644 --- a/packages/backend/server/src/plugins/payment/manager/user.ts +++ b/packages/backend/server/src/plugins/payment/manager/user.ts @@ -179,27 +179,19 @@ export class UserSubscriptionManager extends SubscriptionManager { }; return this.stripe.checkout.sessions.create({ + customer: customer.stripeCustomerId, line_items: [ { price: price.price.id, quantity: 1, }, ], - customer_update: { - name: 'auto', - }, - tax_id_collection: { - enabled: true, - }, - ...discounts, ...mode, + ...discounts, subscription_data: { ...trials, }, - success_url: this.url.link(params.successCallbackLink, { - session_id: '{CHECKOUT_SESSION_ID}', - }), - customer: customer.stripeCustomerId, + success_url: this.url.link(params.successCallbackLink), }); } diff --git a/packages/backend/server/src/plugins/payment/manager/workspace.ts b/packages/backend/server/src/plugins/payment/manager/workspace.ts index 89ba6153cd52a..5ea1971d7feca 100644 --- a/packages/backend/server/src/plugins/payment/manager/workspace.ts +++ b/packages/backend/server/src/plugins/payment/manager/workspace.ts @@ -111,27 +111,21 @@ export class WorkspaceSubscriptionManager extends SubscriptionManager { }); return this.stripe.checkout.sessions.create({ + customer: customer.stripeCustomerId, line_items: [ { price: price.price.id, quantity: count, }, ], - customer_update: { - name: 'auto', - }, - tax_id_collection: { - enabled: true, - }, - ...discounts, mode: 'subscription', - success_url: this.url.link(params.successCallbackLink), - customer: customer.stripeCustomerId, subscription_data: { metadata: { workspaceId: args.workspaceId, }, }, + ...discounts, + success_url: this.url.link(params.successCallbackLink), }); }