How to have multiple subscriptions for each user with Stripe-Xano-WeWeb?

Hi there!

Building an LMS with lesson plans that users can subscribe to for access. Below is link to WeWeb video I am following to set this up, and the chapter my questions is directed at.

In the example, it is creating only one type of “plan” (e.g., Basic, Scale, Enterprise) for each user and updating their login details in Xano db table accordingly. That is updated in Xano Auth plug-in and restricts users for the webpage with roles in WeWeb. However, in my use case, a user can have multiple plans/subscriptions to different lesson plans. I am unsure how to do this since this tutorial only has one plan/subscription type.

Should I differently set up the Xano function listening to the Stripe webhook when new subscription is made to update the login details for the user? I would think I change the “plan” text data type to be a list (so it turns into an array) and then just use XANO append array to add on multiple subscription values. But I am unsure how I would parse through this list of roles in WeWeb to create the user groups accordingly (i.e., there is only one option for a “plan” of a user below and no option to look at a list if that makes sense). Would be hard to manage pausing & ending subscriptions with this array style too.

Please let me know if anyone has any thoughts, thank you!

1 Like

Great question and thank you for the details for your question.

Let me check with the team and see how we can assist you. I will get back to you as soon as possible.

1 Like

Thanks so much, Doc! Welcome to the team by the way, love your YT :slight_smile:

1 Like

Thanks! Also it was great meeting you today! Keep us posted on your progress.

@Luke This is an interesting challenge - I am curious what your path forward is.

FWIW - Seems like you are pretty far down the path of direct Stripe integration - so this might not be interesting or relevant to you - but OUTSETA does a great job of managing multiple subscriptions and add-ons, etc - https://www.youtube.com/watch?v=5Z5b1TLw2m4

If you use Outseta in your stack - it’s membership management layer and auth for your app - you just connect Stripe to your Outseta account and manage/add/edit plan and add-ons in Outseta. With Xano triggers - you can easily manage having a Xano record have an updated ARRAY of active memberships / courses when the User logs in. I was thinking that if each course had it’s own page - you could do an API call to XANO for a boolean if the User has access to that course and if not you re-direct, etc.

Anyway, I just think it’s a really interesting challenge and I am curious how you end up resolving it. I feel like the current Role / User Group for private page access was really designed for admin/user and internal/external access scenario vs. multiple subscription products and it does sound like WeWeb might rework that as they change their export code / WeWeb server stuff.

1 Like

@Doc - thanks for the help in OH! Will keep you & thread updated in progress.

@Mark_Pederson - This is awesome, thanks so much! I attended OH today and Flo had recommended to do the following (paraphrased to my understanding):

  1. Set up the subscriptions in backend with an array list (attending Xano OH to ask them for best practice of where/how to store this data)
  2. Create global workflow for page load which sends API to backend and parses array to check if user is subscribed
  3. Passthrough condition/API error based on status, either redirect to another page which says “Only subscribed users can see content!” or allow them to see the page.
    NOTE: should have precondition in backend on API grabbing the lesson data regardless
2 Likes

@Luke Yeah - this is exactly what I was thinking re: page load API call to check if User has access to course

You will need some way to update that array when User cancels, payment fail, etc - so I guess you will have to do that with Stripe webhooks? But if you do end up looking seriously at OUTSETA - which would give you ability to update that array on login without Stripe webhooks just gimmie a shout. I have WebWeb+Outseta+Xano pretty dialed in.

1 Like

No problem and thank you for your question on the call!
Looking forward to seeing you on a future call. :grin:

1 Like

Yeah will have play around with that. I really appreciate it, thank you so much Mark!!!

1 Like