#rubberduckies_best-practices

1 messages ¡ Page 1 of 1 (latest)

lapis laurelBOT
#

👋 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.

marble forge
#

Otherwise you'd need to build your own UI to facilitate the upgrades that makes the required API calls

fiery hamlet
#

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

marble forge
#

Sorry, not following the 'upsell' part

#

AFAIK portal doesn't support upsells

fiery hamlet
#

lol, maybe i'm making a mess in my thinking process

#

let me try to explain my use case

marble forge
#

i.e. upsell from monthly sub to annual before subscribing

fiery hamlet
#
  • 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

marble forge
#

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

fiery hamlet
#

hmm

#

so i would create a Portal configuration for each customer, or for each type of subscription?

marble forge
#

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

fiery hamlet
#

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?

marble forge
#

You may want to map those specific to the related Customer object, or have them more general. Implementation detail really

fiery hamlet
#

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?

marble forge
fiery hamlet
#

thank you, i'll read the docs attentively

#

can i ask one quick unrelated question?

marble forge
#

Sure!

fiery hamlet
#

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?

marble forge
#

How do you expect that to behave?

#

Are you wanting to link Customer objects?

fiery hamlet
#

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`})
marble forge
#

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)

fiery hamlet
# marble forge 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

marble forge
#

No problem, glad I could help!

fiery hamlet
#

sorry, just one more question

#

are you still there?

last leaf
#

hi! I'm taking over this thread.

#

let me know if you have any other questions.

fiery hamlet
#

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?

last leaf
#

it's the same Subscription, so same ID.

fiery hamlet
#

perfect

last leaf
#

I recommend doing some tests in test mode to see how it works in practice.

fiery hamlet
#

so i'll just receive a "customer.subscription.updated" webhook right?

last leaf
#

correct!