#rubberduckies_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/1278681238063808597
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
If your customer has an existing subscription then you could leverage the hosted customer portal for this: https://docs.stripe.com/customer-management
Otherwise you'd need to build your own UI to facilitate the upgrades that makes the required API calls
Hi
so, yes, i have that part figured out, the customer portal thing
but when i go to my products, and try to create an upsell, there is no way to link that upsell to another product
or at least i haven't found it
lol, maybe i'm making a mess in my thinking process
let me try to explain my use case
Those are essentially only really surfaced on Checkout when initiating new subscriptions: https://docs.stripe.com/payments/checkout/upsells
i.e. upsell from monthly sub to annual before subscribing
You don't need to model the upsells in the Dashboard if you just want your customers to be able to upgrade packages. You'd just configure that on the portal session: https://docs.stripe.com/customer-management/configure-portal#configure-subscription-management
- My customers are "companies", not individual users
- A company can be an "Agency" or a "normal company"
- I have 3 tiers for each type of company
- I have 6 products
- 3 for agency, 3 for normal
- each product has a monthly price and a yearly price
now, this particular agency, is subscribed to the basic plan
(ignore the upgrade buttons for now, please)
i want this customer to be able to, in the customer portal, upgrade to any of the upper plans
is this something that can be done through stripe? I thought so
Should be possible then, you just need to configure the portal session accordingly when you create the config. You specify the Products (prod_xxx) you want to offer upgrades for: https://docs.stripe.com/api/customer_portal/configurations/create#create_portal_configuration-features-subscription_update-products
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
hmm
so i would create a Portal configuration for each customer, or for each type of subscription?
I think in your scenario you'd likely need a separate configuration dependent on the customer type and their current plan
i.e. agency subscribed to prod_agency_a can upgrade to prod_agency_b, etc
I understand, i'll have to look deeper into the documentation you sent
can i ask you how does stripe then handles pricing in those cases?
You may want to map those specific to the related Customer object, or have them more general. Implementation detail really
like: if a customer tries to upgrade in the middle of the month, where he already paid for a lesser subscription, how does that work?
You can control if/how we handle the prorations for the upgrade: https://docs.stripe.com/api/customer_portal/configurations/create#create_portal_configuration-features-subscription_update-proration_behavior
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Sure!
so, as i said, my "customers" are "companies" not "users"
but the way stripe handles customers, we need to have an email attached to it
can we change a customer object, through the api, to set a different email as "manager" of the customer account?
i'll tell you my flow:
- a user registers to our platform
- a user object (as "Owner") and a company object are created in my database
- a stripe customer is created and my user's email is associated to that stripe customer
- in my platform, that Owner user, can invite other users to the platform, associated to the same company
- with different possible roles, "Admin", "Member", whatever
- at a certain point, the owner maybe doesn't want to be the one to be managing billing
- and pass "management" to an Admin
so, i would think something like:
await stripe.customer.update(customerId, {email: 'new_email@company.com`})
Got it. There's no native way to model that today, the easiest way to handle that 'migration' of ownership would be to just switch the email addresses/details on the relevant cus_xxx objects. You can't transfer the subscription between customers, for example (that would involve resubscribing)
Yep, should work
it sure looks a lot easier than what you had proposed in creating new customer, moving subscriptions, handling invoice attributions....
alright, i think i'm good to go for today
as alway, thank you so much for your support, top notch
No problem, glad I could help!
hi soma, thank you
it's about upgrading subscriptions, as per the conversation above
let's say the customer upgrades from one plan to another, from the customer portal
even though the product_id changes, does the subscription itself stays the same (same Id) or a new one is created?
it's the same Subscription, so same ID.
perfect
I recommend doing some tests in test mode to see how it works in practice.
so i'll just receive a "customer.subscription.updated" webhook right?
definitely
correct!