Allow Guest Subscription Before Account Registration in OpenSaaS
In OpenSaaS, is it possible for a guest to complete a subscription with Stripe or Lemon Squeezy before registering an account?
13 Replies
Hi @Lucas. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the provided knowledge sources, there isn't enough specific information to definitively answer whether OpenSaaS allows guest subscriptions before account registration with Stripe or Lemon Squeezy.
The documents mainly discuss Stripe integration and subscription handling after user registration, but they don't explicitly address the scenario of guest subscriptions prior to account creation.
However, it's worth noting that the default behavior in Wasp (which OpenSaaS is built on) typically requires user authentication before accessing certain features. For example, the Auth Overview documentation (https://wasp-lang.dev/docs/auth/social-auth/overview#default-behavior) mentions that when a user signs in for the first time, Wasp creates a new user account and links it to the chosen auth provider.
To implement guest subscriptions before account registration, you would likely need to customize the existing authentication and payment flows significantly. This isn't explicitly covered in the provided knowledge sources.
If this feature is crucial for your use case, you might want to:
1. Check the latest OpenSaaS documentation for any updates on this functionality.
2. Consider asking this specific question in the Wasp community Discord channel, where developers and maintainers might provide more current and detailed information.
3. Explore the possibility of customizing the OpenSaaS template to implement this feature, which would require in-depth knowledge of both Wasp and the payment provider's APIs.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Lucas, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?
Hi @Wasp Team , Can you help me determine if it is feasible or if it requires significant customization of the existing authentication and payment flows? I would greatly appreciate your support.
I’m actually not sure about this @Lucas you’d have to dig into the stripe documentation but I do think it’s possible if the user manually enters an email address.
The problem here is you have no way of being able to identify the user when they return to your app, so this method isn’t advisable if the user needs to return and do something on your app.
Hm yeah sounds a bit complex. We do have something call pre-signup hook, I imagine that might be useful here, but still it sounds a bit tricky. What is your motivation for this @Lucas ? What about signing them in and then requireing stripe if they want to accesss certani part of app or functionatily?
Thank you, @Vinny (@Wasp) , and @martinsos for your feedback. The purpose of Guest Subscription is to increase conversion rates, reduce the number of steps for users, collect potential customer emails, etc. Some systems still have this feature. From my research, we can store subscription information (such as email, plan, and status) in the database (via Stripe event webhooks). After that, we can send an email to the guest asking them to create an account, and once they do, we can link the newly created account to the activated subscription.
Alternatively, we can create an account with an empty password and send an email for the user to update it. This is a feature I think is quite complex, so I hope that in the future, Wasp and OpenSaaS will be able to support it.
This is a pretty clever approach.
You could also do this with Wasp's
email
auth method. But you'd have to assign them a "placeholder" password automaticaly, and then send them a custom Reset Password email that allows them to set a new password right awayBut I'm not sure if there are security issues with this approach so I'd do some research.
But just wanted to let you know that it is possible with Wasp https://wasp-lang.dev/docs/auth/email#creating-a-custom-sign-up-action
Email | Wasp
Wasp supports e-mail authentication out of the box, along with email verification and "forgot your password?" flows. It provides you with the server-side implementation and email templates for all of these flows.
maybe @miho has some tips here too. He is out Auth master..
You could probably use an entity in your DB that's unrelated to the
User
auth entity. Let's call it Customer
. It has some email
field. You create thie Customer
in your Stripe web hook, great!
You email the user, hey create your account at this link
. The user creates their account, you then in the onAfterSignup
auth hook, link the Customer
with the User
entity by checking the email
field on the Customer
entity.
This way - you get to store some data in the DB. Use Stripe's data e.g. user's email which is verified - store it in the DB. Later on, when the user signs up and verifies their email - you can safely connect those two things.Ohh this is a great idea, miho. Check it out @Lucas 👆
NIce @miho -> so Customer can be linked to the User or not, meaing they can create it first, and later link it to the User. Neat, correctly reflects the domain I believe.
Thank you, @miho. The approach of using the
Customer
entity and the onAfterSignup
auth hook is great. I will try implementing it @Vinny (@Wasp) @martinsosWohooo @Lucas, you just became a Waspeteer level 1!