#edutomesco

1 messages · Page 1 of 1 (latest)

rugged pythonBOT
lyric relic
#

👋 happy to help

#

could you please elaborate more and give some easy example, I wasn't able to follow, sorry my bad

late grotto
#

sorry

#

4 prices compose a subscription

#

4 prices reference to 4 products it's a subscription with multiple products

#

3 prices reference to my fix product subscription: composed with 2 metered prices and 1 fixed price

#

the last 4th price reference to one Add-on that customer can optionally subscribed or not

#

when a customer wants to make an update of his subscription

#

If he wants to upgrade for example from Basic plan to Smart plan

#

I will detect an upgrade so I will update the subscription with the new items and prorate them

#

But if at the same time the customer select to unsusbcribed from the 4th Add-on item

#

I will like to mantain this price because the customer has already paid it. I want to keep this price until the subscription cycle change

#

Better?

#

And idk how to handle this

lyric relic
#

sorry let me take a look, discord got busy all of a sudden

#

I'm not sure it's possible in the same API call let me try to test this out

late grotto
#

Okey thanks

#

Are you checking?

lyric relic
#

I'm sorry for the delay @late grotto

late grotto
#

don't worry

lyric relic
#

I'm all yours now @late grotto

#

I will give you the answer as soon as I'm done testing

#

sorry again

late grotto
#

don't worry

#

I wait here XD

lyric relic
#

I just have 1 more question for you

#

do you want to have the billing cycle change and immediately get paid for the upgrade?

late grotto
#

I've never changed the billing cycle, I just compared the next invoice total with the actual and the new plan and if it's more expensive the new one I do an upgraded so I update the subscription with the new prices and paid for that, but if it's cheaper I do a downgrade and I do a schedule for the next billing cycle

#

undesrtand?

lyric relic
#

no not really

#

let me try to explain in my own words and you tell me if I'm on-point

#

so let's say you have a Subscription with 4 prices (price_1, price_2, price_3 and price_4)
at some point in time you want to upgrade price_1, price_2, price_3 to price_5, price_6, price_7 and remove price_4 is that correct up until now?

#

price_1 10$
price_2 15$
price_3 20$

#

price_4 25$
price_5 30$
price_6 35$
price_7 40$

lyric relic
#

ok so let's say this happens in the middle of the month so what you want to have is a new invoice on that day with prorations on price_1,2,3 and 5,6,7 with no change to the billing cycle?

lyric relic
#

meaning (-5 -7.5 - 10) + (15 + 17.5 + 20)

late grotto
#

Yes

lyric relic
#

ok

late grotto
#

here the important thing is what happens with price4 that the user don't want anymore

#

But he already paid so I want to keep that price until the billing cycle finish

lyric relic
#

ok that's fine

#

I was able to do that in 2 steps

#

I want to try and see whether it's possible in 1 step (I'm afraid not but let me double check)

late grotto
#

Okey

lyric relic
#

yes unfortunately you wouldn't get your desired result in 1 step

#

so basically what you need to do is the following

#

1st update the subscription passing in the items array { id: 'si_xxx', deleted: true} (with si_xxx the Subscription Item id) and billing_cycle_anchor: "unchanged", proration_behavior: "none"

late grotto
#

but I want to prorate

lyric relic
#

in the 2nd step you would also do an update to the subscription this time you will update the price for each Subscription item also passing the id: 'si_xxx' to each item with the new price id but proration_behavior: "create_prorations", billing_cycle_anchor: "unchanged" in this case

#

you don't want to prorate price_4 right?

late grotto
lyric relic
#

no need to schedule, this will change the Subscription Items to the new prices immediately and creates the proration on the next invoice

late grotto
#

I mean in general

#

if I want to do a downgrade and just wait to finish the actual billing cycle with the current prices, I need to do it with a schedule right?

lyric relic
#

no

#

in that case you would use proration_behavior: "none" and billing_cycle_anchor: "unchanged"

late grotto
#

And when you will use schedule then?

lyric relic
#

You should avoid using schedules unless there's no other choice

late grotto
#

I don't know that

#

thanks

#

I will change all the logic then

lyric relic
#

these are normally the case where you have things like first 2 months you have a price, then you have a yearly price for 2 years then you have a discounted price for x years then something else

late grotto
#

And there is anyway to detect if it's an upgrade or downgrade?

lyric relic
late grotto
#

What I do is check the total next invoice between the actual plan and the new plan

#

is that right?

#

or there is an easy way?

lyric relic
#

I mean it should be part of your app (and not directly related to Stripe)

#

you should be able to know from the action that your customer is taking whether they are upgrading or downgrading

#

I'm not really sure how you do that in your app but the general idea is that you give your customer a choice and you should be able to see whether it's an upgrade or a downgrade based on their choice

#

one more Q, what if the customer chooses to upgrade a price but downgrade the other?

late grotto
#

I will do the operation in two steps as you said

lyric relic
#

no in that case, you would deal with upgrades together and downgrades together in 2 steps

#

whenever you're downgrading use proration_behavior: "none" and billing_cycle_anchor: "unchanged" and when upgrading proration_behavior: "create_prorations" and billing_cycle_anchor: "unchanged"

#

and you would only update subscription items that are relative to the upgrade/downgrade

#

and you can then add the deleted one in the downgrade call

late grotto
#

Nice

lyric relic
#

I need to step away but feel free to ask any follow up Qs my colleagues would be able to help you out