Skip to content

Commit 15a0935

Browse files
committed
redirect to org settings when checking out during onboarding
1 parent 16c5b6b commit 15a0935

File tree

1 file changed

+4
-1
lines changed
  • apps/web/app/api/settings/billing/subscribe

1 file changed

+4
-1
lines changed

apps/web/app/api/settings/billing/subscribe/route.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,14 @@ export async function POST(request: NextRequest) {
6262
.where(eq(users.id, user.id));
6363
customerId = customer.id;
6464
}
65+
6566
const checkoutSession = await stripe().checkout.sessions.create({
6667
customer: customerId as string,
6768
line_items: [{ price: priceId, quantity: quantity }],
6869
mode: "subscription",
69-
success_url: `${serverEnv().WEB_URL}/dashboard/caps?upgrade=true&session_id={CHECKOUT_SESSION_ID}`,
70+
success_url: isOnBoarding
71+
? `${serverEnv().WEB_URL}/dashboard/settings/organization?upgrade=true&session_id={CHECKOUT_SESSION_ID}`
72+
: `${serverEnv().WEB_URL}/dashboard/caps?upgrade=true&session_id={CHECKOUT_SESSION_ID}`,
7073
cancel_url: isOnBoarding
7174
? `${serverEnv().WEB_URL}/onboarding`
7275
: `${serverEnv().WEB_URL}/pricing`,

0 commit comments

Comments
 (0)