#victor-checkout-authentication
1 messages · Page 1 of 1 (latest)
victor-checkout-authentication
Hey @ebon copper ! Your own code creates the Checkout Session server-side so you should be able to enforce authentication before creating the Session right?
I was trying to prevent having an intermediate step between clicking subscribe on my pricing page and going to the checkout. So basically an unauth user should be able to sign up to a subscription and have an account created on my backend once they are thru the checkout workflow.
I don't really get how you can want no authentication but also want return customers to always be authenticated
it's one or the other mostly
So if i am a new user who visits my site, i go to the pricing page, click subscribe which takes me to stripe checkout. The checkout page collects the users email, my backend listens for the webhook event indicating checkout was successful and creates an account for the user and sends them an email indicating this. I dont create a session on my backend. Does that explain it better?
sure but then I come back do the same thing, you never ask me who I am, and there's no "customer account" on Checkout
I also have an authenticated workflow whereby i supply the customer to the checkout session. But its the unauth workflow that has the issue of being able to subscribe N times due to not knowing the customer before creating the checkout session.
yes that's what I'm trying to explain
there's no way to do "customer accounts" on Checkout. So you have to ask that information upfront. But ultimately the customer can always not remember they already have an account right?
But stripe knows the customer from the email on the checkout form, couldnt it block the checkout if they are subscribing to something they already are subscribed to?
no because we don't have any logic for "unique customer email on Customer"
there's no such thing, so it's something that's mostly impossible here
Or send a webhook event?
I mean we do send a webhook Event after completion and you can de-duplicate yourself then. But not before the payment
Hmm ok, so to fix this i should auth the user beforehand.
yes though you will always have people forget they have an account and go pay in Checkout, there isn't a way to avoid this
But by authenticating it should stop users from duplicating a subscription and prevent me from having to implement that logic on my backend?
possibly, I don't really follow what you mean by authenticate. Are you asking them to sign up first?
Yep, sign up or login to my backend first.
gotcha, then yes that should work
Ok thanks very much for your help 😊
of course!