#rich-jones_best-practices
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1419592505380573215
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi! Can you provide more details about the business case: need a one buys for many model and one that does not allow seat pooling.?
so my clients will be businesses and one of the users in each business will be the billing contact and will have access to a debit or credit card to pay for the subscriptions of eveyone on their business
I want each subscription to be tied to a named user so that my clients cannot rotate users to subscriptions
Currently my app creates a stripe customer silentlly via an API call when the first user signs up for a free trial
And 'buys' (again silently) a ยฃ0 free trial subsription
Sounds like you're describing this: https://docs.stripe.com/connect/subscriptions#connected-account-platform
I want my app to have minumim code so I want to exploit as may of the features of stripe as possible
Yeah a Connect setup is pretty involved and will require at least some code/developer integration experience
This connected-account-platform is not an apporach I've seen so far....
So my business clients are the gym, and I need a per seat charging model, is that right ?
Hmm, maybe I misinterpreted your use case. To clarify, you're building a platform on which your users can bill/charge their customers, but you want to charge your customer for use of the platform?
M y app so far makes API calls and has a webhook setup, both are working fine
My first app is a CRM like app, my clients will be small/medium size businesses and the users will be their sales/finance team members
OK< but there's not multiple parties? e.g. your clients are not charging customers too?
So someone in the company will pay the subscription fees for all the users.
Correct
OK, then disregard Connect that's irrelevant. My bad
Then it sounds like you're describing a regular pet seat subscription model where you only ever have 1 seat (quantity), and then your application will have logic to 'allow' other users to access the product undernearth the active Stripe subscription
Just FYI I experimented with the SupaBase Stripe FDW, but ditched that in favour of webhooks, but happy to use FDW if helpful
In my head each user is a seat, so if Acme Inc use my app, and they have 3 staff using the app, then I want someone in Acme Inc to pay 3x subs each month. And if possible for each user to be tied to a 'license' so that 5 people can't share 3 licenses
Then you'd model that like this: https://docs.stripe.com/products-prices/pricing-models#per-seat
Your app would need to handle the limitation logic to prevent 5 users for 3 seats, etc
Thank you, this is what I have been using as a model so far.
Great! Then what Stripe specific Qs can I help with?
If you refer to this : #1419592505380573215 message
When I create the customer (silently), when the trial expires can I use a stripe checkout to add a payment and to allow products to be chosen ?
Yes: https://docs.stripe.com/billing/subscriptions/build-subscriptions?platform=web&ui=stripe-hosted
Great, thanks for confirming this for me.
As I said, the logic that controls a subscription having 3 seats and restricts access to 3 'users' of that subscription is something you'd need to implement in your app. As an example:
- User Y subscribes to product 1. They buy 3 seats for their business
- Your app allows user Y to configure their seats inside your app
- They add abc@, xyz@ and foo@ to their account to 'fill' the sctive seats
- Now when those email addresses sign in to your app, your app can check that they still have access to an active/paid Stripe subscription and allow them to access it
- Other email address should be forced to sign up separately
Once a payment has been attached to the customer, can any of my users change the quantity or does this need to be a specific person, e.g. the contact for the customer
Well you can control that. In theory anybody can update the subscription as your app would be facilitate the API call. So again you'd need to restrict updates to the sub to be limited to the 'owner' user in your app UI
Is there a way to tie a license to a subscription in stripe? I am aware I can add metadata to the stripe customer, so I could use that.
Can model this is as like a authorization system (e.g. user Y has permission to update/cancel the sub, but the other users I mentioned don't)
Yes, likely model it with metadata or maybe use an Entitlement: https://docs.stripe.com/billing/entitlements
I can't see how entitlements would work, can you explain please ?
It's a way to know if/when to provision/unprovision access to features in your app
If the license part is purely a license number or something then I'd just use metadata on the Subscription
Can I loop back on Supabase's FDW for stripe ?
Sure, but I'm not really familiar with it
It allows my DB to have a read replica of the stripe tables contained within it
What's the Q?
I guess it would be "Is this a better option than Webhooks for being notified of changes ?"
I don't think that would actually notify you of changes though? It just keeps things in-sync between your Postgres instance and Stripe account?
Yes, so I would have to read the database to check, so I think Webhooks a better option. I have stripe pointing to an edge fucntion within the database which seems to work well
Still feels like webhooks are crucial especially for a Billing integration where you want to know if/when payments fail, users cancel a sub, etc
I agree.
Sounds good
Good docs article on this: https://docs.stripe.com/billing/subscriptions/webhooks
Thank you for clarifying things for me. I was on the right track, so I'll crack on a code up my app as needed ๐
Perfect, let us know if you have any follow-ups
Can I come back to this discussion if needed later ?
We close the threads after ~30 minutes, but you can always reference it afterwards. Any other Qs will need to be a new thread via #help
So I can grab a link to this and refer to it in a new help request ?
Yep, that works. The bot actually tells us if you've had any recent threads, too
Cool, thank you very much, you've been brilliantly helpful ๐
No problem, glad I could help!
Have a great day
you too!