Skip to content

Commit

Permalink
🚑 (billing) Fix checkout session email check
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Jun 27, 2024
1 parent 7f82c2f commit be28d9d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ee/packages/billing/api/createCheckoutSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ export const createCheckoutSession = async ({
email,
})

if (existingCustomer && email !== existingCustomer.data[0].email)
if (
existingCustomer.data.length > 0 &&
user.email !== existingCustomer.data.at(0)?.email
)
throw new TRPCError({
code: 'BAD_REQUEST',
message: 'Make sure to log in with the same email as the one provided',
Expand Down

0 comments on commit be28d9d

Please sign in to comment.