Skip to content

Commit

Permalink
fix(server): minize checkout parameters (#9090)
Browse files Browse the repository at this point in the history
  • Loading branch information
forehalo authored Dec 10, 2024
1 parent 18d65df commit 1721875
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
14 changes: 3 additions & 11 deletions packages/backend/server/src/plugins/payment/manager/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
});
}

Expand Down
12 changes: 3 additions & 9 deletions packages/backend/server/src/plugins/payment/manager/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
});
}

Expand Down

0 comments on commit 1721875

Please sign in to comment.