How to redirect to stripe page only when the user has signed up successfully on a pop-up?

Hi everyone!

I’ve been struggling to handle an authentication. My SaaS has a purchase plan button on landing page. When clicking in the button, the expected flow is:

  1. If the user is signed-up or logged-in, redirects to stripe page (it’s working perfectly)
  2. If the user is not signed-up
    2.1) opens the sign-up popup
    2.2) when user signs-up successfully, redirects to stripe page

The step 2.1 has a register button, how do I proceed to stripe page and redirects only when the user has signed-up successfully?

The pop-up and sign-up button are in the same page.

Thanks in advance!

Hi @hugoalves

I have done this in numerous client projects. The process doesn’t require URL parameters.

In your workflows, you have a button that is clicked to purchase. On that button click trigger (ie: when button purchase is clicked) you will need to have a conditional on the trigger itself, which is ‘when current user is logged in is yes’ and run the flow for navigating to Stripe, which from sounds of it, is already working, but just may be missing the conditional trigger to get your desired function working fully.

Then, create another trigger for when button purchase is clicked and add a conditional for ‘when current user is logged in is no’, and that trigger should show the popup for signup…now, there are considerations about what to do next, that I do not know the answers to because I do not know if your signup popup on the page is a reusable element or is a popup you created just for the page.

One way to go about it, regardless of whether the signup popup is a reusable element or a popup on the page, you can add to the popup a custom state, which is ‘payment-mode’ and is a yes/no value…no means it is regular loging/signup, but a yes value is the user is needing to login/signup for the purposes of making a payment. Then on the reusable element or page (again, not sure how your signup popup is setup), add a workflow for when the popup is closed with conditional when user is logged in is yes, and payment mode is yes…that workflow will need to navigate the user to the checkout URL of Stripe.

To make it so the popup knows what the URL of Stripe is, you’ll want to add a custom state called URL of type text…Now, we need to backtrack a bit, because on that trigger for when button purchase is clicked and the current user is logged out, where you are showing the login popup, you’ll need to set the custom of the Stripe URL, so, in that same workflow series, you’ll need to run your API call to create the checkout session, then set custom state on popup of the payment mode is yes and URL to equal the URL from the API call.

So the setup will make it so once the login popup is closed and the user is logged in and the URL custom state value is set properly and the payment mode custom state is yes, the user will be redirected to the Stripe hosted checkout session.

If, you are doing things with the Stripe checkout that require a customer object to already be present in the API call, then you’ll need to tweak things so that you can, when the popup is closed and the payment mode custom state is yes, to capture the now logged in users stripe customer ID to run the API call and navigate to Stripe checkout page in workflow for when the popup is closed.

1 Like

@boston85719, you’re literally a life-saver! thank you so much for the detailed answered! i’ve got the idea and it worked like charm!!

1 Like