fix: Onboarding v3 - create team then invite. (#25364)

## What does this PR do?
This PR changes the order of creating the team -> paying -> invite users.

The old approach was create team -> invite -> pay. But we are matching the current implementation of how billing works with usage based billing

## How should this be tested?

Enable onboarding-v3 flag on your instance
Ensure you have stripe enabled + stripe:listen running
login as [email protected], onboarding
Go through the team setup flow
Pay
Invite
Ensure uers were added to team

Create a new account
disable billing
Test again 

## Checklist

<!-- Remove bullet points below that don't apply to you -->

- I haven't read the [contributing guide](https://github.com/calcom/cal.com/blob/main/CONTRIBUTING.md)
- My code doesn't follow the style guidelines of this project
- I haven't commented my code, particularly in hard-to-understand areas
- I haven't checked if my changes generate no new warnings
This commit is contained in:
sean-brydon authored and GitHub committed 2025-11-25 09:14:59 +00:00
1 parent 2b2bf36703
commit d03f45dd0f
7 files changed
+166 -37

No files matched your search

+4 -2
View File
@@ -113,8 +113,10 @@ async function getHandler(req: NextRequest) {
const isOnboarding = checkoutSessionMetadata.isOnboarding === "true";
if (isOnboarding) {
// Redirect to event-types for onboarding flow
return NextResponse.redirect(new URL("/onboarding/personal/settings", WEBAPP_URL), {
// Redirect to invite flow after payment for onboarding with teamId as query param
const inviteUrl = new URL("/onboarding/teams/invite", WEBAPP_URL);
inviteUrl.searchParams.set("teamId", team.id.toString());
return NextResponse.redirect(inviteUrl, {
status: 302,
});
}