fix: checkout

This commit is contained in:
Carl-Gerhard Lindesvärd
2025-10-18 10:28:56 +02:00
parent 4b831204b7
commit 21fc076368
5 changed files with 5 additions and 21 deletions

View File

@@ -13,14 +13,8 @@ export const polar = new Polar({
server: process.env.NODE_ENV === 'production' ? 'production' : 'sandbox',
});
export const getSuccessUrl = (
baseUrl: string,
organizationId: string,
projectId?: string,
) =>
projectId
? `${baseUrl}/${organizationId}/${projectId}/settings?tab=billing`
: `${baseUrl}/${organizationId}`;
export const getSuccessUrl = (baseUrl: string, organizationId: string) =>
`${baseUrl}/${organizationId}/billing`;
export async function getProducts() {
const products = await polar.products.list({
@@ -52,13 +46,11 @@ export async function createPortal({
export async function createCheckout({
productId,
organizationId,
projectId,
user,
ipAddress,
}: {
productId: string;
organizationId: string;
projectId?: string;
user: {
id: string;
firstName: string | null;
@@ -73,7 +65,6 @@ export async function createCheckout({
successUrl: getSuccessUrl(
process.env.DASHBOARD_URL || process.env.NEXT_PUBLIC_DASHBOARD_URL!,
organizationId,
projectId,
),
customerEmail: user.email,
customerName: [user.firstName, user.lastName].filter(Boolean).join(' '),