Search code examples
firebasefirebase-authenticationemail-verificationstripe.js

When do I verify the email before creating a subscription with stripe?


  1. I know stripe doesn't have anything to do with verifying emails.
  2. I have a form on my website where I collect a new user's email, password and cc info.
  3. As of now I do not verfiy the user's email. I simply create the user in my system and create the strip user and subscription after I get the card token with stripe.js.
  4. I want to verify the email address, but I am not sure at what point in the process to do it. I don't think it makes sense to charge the customer and start the subscription and then verify the email address.

Should I wait and start the stripe subscription when the customer verifies the email address? It seems like this is one of the most common scenario's online. Is their a best practice for this scenario?

Again, I am not asking technically how to verify the email address (I use firebase auth), I just want to know when I should and how it should fit into my onboarding flow.


Solution

  • You can after Firebase Auth account creation, check if the emailVerified is true. If not, send an email verification and pass a continueUrl to continue the subscription process, instructing the user to check their email to continue the subscription process. This is a common process for many subscriptions that require email verification.

    You can learn more about passing continueUrl via email verifications: https://firebase.google.com/docs/auth/web/passing-state-in-email-actions

    You can build your own custom landing page where you continue the subscription using the following instructions: https://firebase.google.com/docs/auth/custom-email-handler

    Make sure you check email_verified in the idToken after ID token verification to confirm verification, server side.