#davidthorand

1 messages ยท Page 1 of 1 (latest)

rain jackalBOT
#

Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

cosmic coyote
#

Hi
Can you share an example please ?

lilac seal
#

Sure! So let's say a customer is on the "Starter" Plan and now wants to upgrade to the "Pro" Plan. I want them to see a preview of what to expect cost-wise from the new plan. So what I'd so is retreive an upcoming invoice with the requested plan/it's price ID.

So far so good. Another thing that needs to be kept in mind is that in case of the new price having a higher amount than the current price, the upgrade should happen immediately. In case of a downgrade, it should happen at the end of the current billing period.

Does that help?

cosmic coyote
#

Do you have a Subscription Id ?

lilac seal
#

Yes

cosmic coyote
#

the upgrade should happen immediately. In case of a downgrade, it should happen at the end of the current billing period.
YOu can manage this using Subscription Schedule

lilac seal
#

Yes, but I want to show the customer a preview first before creating a schedule of the actual subscription update

cosmic coyote
lilac seal
#

Does not seem to work:

[1] { currentPeriodEnd: '2024-12-12T11:53:26.000Z' }
[1] { newPeriodStart: '2023-12-12T12:24:38.000Z' }
[1] { newPeriodEnd: '2024-01-12T12:24:38.000Z' }
cosmic coyote
#

What is the issue/result ?

lilac seal
#

The expected newPeriodStart is after currentPeriodEnd. But it's not

cosmic coyote
#

These fields refer to what in Stripe API ?

#

Can you share the SusbcriptionId you are doing your test with

lilac seal
#

The fields come from:

const currentPeriodEnd: currentSubscription.current_period_end;
const newPeriodStart = previewInvoice.lines.data[0].period.start;
const newPeriodEnd = previewInvoice.lines.data[0].period.end;

The Subscription ID is: sub_1OLWURAuRq0b7FtTBvRzrK9l

cosmic coyote
#

Why you are comparing the preview invoice dates with the current subscription period ?

#

What value are you passing to the proration_date ?

lilac seal
#

currentPeriodEnd

lilac seal
pulsar pulsar
#

Hi! I'm taking over from my colleague. Please, give me a moment to catch up.

pulsar pulsar
lilac seal
#

Sure, sec

#

req_Cu4ss8fR84QpKS

pulsar pulsar
lilac seal
#

Yes, you're right. I commented it out to try something different. New Request ID incoming

#

req_8eAYDugyr1E5vR

pulsar pulsar
#

Do the responses differ? (I can't see the response of the GET requests on my side)

lilac seal
#

Haven't compared every value but the relevant ones seem to be the same (new period start & end)

pulsar pulsar
#

I need a moment to check something...

#

Maybe that's the reason why it ignores the subscription_proration_date.

lilac seal
#

So what should it be then? none? Because then the request would fail since you can not specify a proration date if no proration is being done (see req_PdQRvz50Pbiz4l)

pulsar pulsar
#

By default the proration date is "now"

lilac seal
#

And when I set it to create_prorations the result is the same as before

pulsar pulsar
lilac seal
#

I don't follow. So how can I make it work then?

pulsar pulsar
#

Updating subscriptions is always tricky, let me try a few ideas...

lilac seal
#

It's weird that almost all update scenarios work perfectly fine except downgrading from a yearly interval to a monthly interval

pulsar pulsar
lilac seal
#

This did not work either, plus it broke some other already working scenarios

#

req_HGbetjxZ1G9uDG

#

Or does it need to be combined with another param?

pulsar pulsar
#

Can you try proration_behavior: "none"?

lilac seal
#

Same result. Is there really no "standard" way of letting the customer preview what happens to their subscription if they change to another price?

pulsar pulsar
#

I am actually not sure what do you want to calculate if you update (yearly -> monthly) the subscription at the end of the current cycle? The bill will just be the monthly amount, that's it. Unless there's a misunderstanding.

lilac seal
#

Expected outcome is that the customer sees the following information:

  • When will the next charge occur?
  • What will it cost?
  • When will it renew after the first charge?
#

So let's say you have a yearly plan since today and want to upgrade to a monthly plan for 20 EUR/mo. The data would be:

  • Next charge: 12.12.2024
  • Cost: 20 EUR/mo
  • Renews at: 12.01.2025
errant totem
#

You can't really set upgrades/downgrades on X date in future like that where the billing interval changes (i.e. yearly -> monthly) without using a schedule. We will always immediately reset the billing anchor in those scenarios

errant totem
rain jackalBOT
lilac seal
#

@errant totem for the actual subscription change, a schedule is definitely needed.

Just so we are on the same page here: There is no "stripe native way" to do what I want to do so I just have to handle it myself, right?

opal mural
#

๐Ÿ‘‹ sorry for the delay, stepping in as ynnoj needed to step away

lilac seal
#

Hey again ๐Ÿ™‚

opal mural
#

Yes you are correct -- if you don't have a schedule attached then you would need to implement logic yourself

lilac seal
#

Got it! I guess I'll do that then, thanks for clarifying ๐Ÿ™‚

In the meantime I already took a look at how schedules work. It's not possible to schedule an update for an existing subscription, isn't it? It always creates a new one, right?

opal mural
#

You can attach a schedule to an existing Subscription, yes.

#

Then you update the Schedule to correspond with what you want

lilac seal
#

Ahhh I see. So I create the schedule for the existing subscription, add phases etc. afterwards and when it finally releases, it's still the same subscription as before, yes?

opal mural
#

Yep

lilac seal
#

Does it need to be activated somehow? Or will this happen automatically once I added the phases etc.?

opal mural
#

It happens immediately once phases are associated

lilac seal
#

Awesome

opal mural
#

it's still the same subscription as before,
It is the same as the final phase

#

To be clear

lilac seal
#

But the same subscription ID, right?

opal mural
#

Yes

lilac seal
#

Then it's exactly what I need, thank you ๐Ÿ™‚

opal mural
#

Great!

lilac seal
#

Final question for today (hopefully): Is there some kind of service similar to the dev-help here which is more about plan modeling etc.? Would be super helpful to get some feedback on my setup here

opal mural
#

We are happy to talk about any technical questions so we will help if we can, but otherwise you would want to reach out to our Support team via https://support.stripe.com/contact/login about any non-technical questions.

lilac seal
#

Alright, thank you!

#

Have a great day