#TonyS

1 messages · Page 1 of 1 (latest)

jagged chasmBOT
heady gorge
#

Hey there

#

Released means that the underlying Sub is kept going whereas canceled means the underlying Sub was also canceled at the end of the Sub Schedule

ruby dew
#

Ok what we try to do is the following : our user can downgrade their current subscription with another subscription and hence loosing some privileges. What we do is schedule the new subscription at the end of their current subscription so this is "smooth" downgrade.

#

We like to print to them how much they will pay and hence we create subscription to have access to all the details about price etc... and then release the subscription schedule. It's made only to do a simulation

#

The subscriptionSchedules of the Customer is therefore not empty, and contains a subscription plan with a status "released"

#

Could we consider that this "released" status means the schedule is not going through?

#

(Sorry if I'm unclear do not hesitate to ask about more details)

heady gorge
#

That said, why are you creating a new Subscription upon the downgrade, why not just downgrade the current Subscription?

ruby dew
#

Ok I simplified a little bit our use case I will go more in details and you let me know if we do the right thing

#

We have 2 kinds of subscription : Basic and Pro. Pro has more features obviously and is more expensive. Users can pay monthly of yearly for both plans

#

We let our users change their plan freely in their account details

#

meaning a Customer that paid Basic Yearly can decide to upgrade to a Pro Yearly plan. Hence, we apply a discount proportional to the amount of unused days of his Basic Yearly subscription.

#

We have 2 parts : 1) we show the user how much he will pay by doing the switch 2) Actually doing the switch

heady gorge
#

Hence, we apply a discount proportional to the amount of unused days of his Basic Yearly subscription.
You are calculating this yourself right now?

#

Or you use our proration?

ruby dew
#

we indeed use stripe proration to do the calculation

#

We do not downgrade immediatly the subscription because someone that for example switch from Pro Monthly to Basic Monthly will still benefit from the Pro Feature until the end of his period

#

We rely on subscriptionSchedule to do the simulation with the proration data and get the calculation of the discount and so on

#

Do you think this is not the right way of doing this?

heady gorge
#

Well it depends. That is a fine way to do it if you are going to leave the Sub Schedule in place and then downgrade at the end of the cycle based on the Sub Schedule actions. It sounds like from the above that you are instead canceling the Sub and creating a new one at the end of the cycle?

ruby dew
#

we release the subscription since we use it only to "simulate" the price and show the calculation to our users

#

the subscription schedule*

heady gorge
#

How do you perform the actual update?

ruby dew
#

depending if it's an upgrade or a downgrade we change the plan or we create a subscription schedule

heady gorge
#

Oh okay. So you are literally just creating a Sub Schedule for the preview here in your UI and then handling the upgrade/downgrade separately.

ruby dew
#

yes

heady gorge
ruby dew
#

Ok I'll check it out thanks you so much

heady gorge
#

That endpoint allows you to preview any update to the Subscription

ruby dew
#

that seems awesome

heady gorge
#

And it will do all of the calculations that you are currently relying on the fake Sub Schedule for

#

So yeah, check that out

ruby dew
#

and then the invoice is "deleted" ?

#

we have to delete it by hand

heady gorge
#

It doesn't actually create an invoice at all

#

It just previews what the invoice would be

ruby dew
#

Ok I think we tried this solution but I do not recall exactly why we discarded it, I'll have a look thanks again very much

heady gorge
#

Check it out and come back if you run into any challenges!

ruby dew
#

Just to be clear, to do the exact simulation

#

meaning

#

someone paid 150€ at a Basic Yearly Plan and used only 50% of his plan

#

and decide to upgrade to a Pro Yearly Plan at 200€

#

we should show to him 200€ - 75€= you'll pay 125€

heady gorge
#

Yep that endpoint will calculate that

ruby dew
#

this is done with the Retrieve an upcoming invoice ?

heady gorge
#

You use subscription_proration_date to indicate when the update occurs

ruby dew
#

So retrieve actually "create" an invoice kind of ?

heady gorge
#

Yep basically simulates the creation of an invoice for you with all the details

ruby dew
#

Ok checking it now thanks! Have a great day