#morunas

1 messages · Page 1 of 1 (latest)

warped nicheBOT
smoky crag
#

but if I use Invoice::upcoming using subscription fields with proration date at end of current subscription period it will resolve into the current schedule applying over that subscription.
Not sure what you mean by this, can you clarify

dapper summit
#

So at the moment this subscription on our test environment sub_1Kgo67CmkexAVRw94RVnhHXn has an update scheduled for going from "Pro" (15.995€) to "Advanced" (9.995€) plan which includes a price change. If I now want to preview the upcoming invoice if instead of Advanced it was "Basic" (5.995€), and use Invoice::upcoming with the basic price, it will still return the 9.995€ (I assume because there is a schedule for that)

#

In other words, if a client has scheduled a downgrade, and before that happens wishes to change it (e.g. to reschedule with another configuration) how do I preview the upcoming invoice?

#

This is easy when not using Schedules because I can pass the subscription_items to Invoice::upcoming, but I cannot pass a schedule with items

smoky crag
#

So you want to preview the invoice difference for an already scheduled change to another hypothetical change?

dapper summit
#

Well, not difference. Sorry I am unclear, let me try another way:

  1. client is on a Plan 3
  2. client requests a downgrade to Plan 2
  3. I give a preview and say it will happen at a future date
  4. client accepts and we schedule the downgrade (so far so good)
  5. client decides to request instead a downgrade to Plan 1
  6. I want to give a preview of Plan 3 -> Plan 1 (with a future proration date)
#

but when I call Invoice::upcoming with Plan 1 price, it will give me a Plan 2 price

smoky crag
#

Ah, ok. Then if you existing sub_xxx that is controlled by the schedule is still on Plan 3 (as the scheduled changes hasn't happened) then you should be able to pass both subscription and subscription_items to preview a Plan 3 -> Plan 1 change

dapper summit
#

yes, that's what I would want... but it gives me the Plan 2 price instead

#

what I am doing is overwriting the price on the existing subscription item id... perhaps I should mark that subscription item as deleted and pass another/new subscription item?

#

that doesn't seem to work either...

#

Ok I seem to have found a solution by simplifying:

  • Since the "future change" it always at the end of the current subscription (no matter what is scheduled) I can use Invoice::upcoming with subscription_start_date = currentSubscription->current_period_end (so "as if" a new subscription would be created)
#

It just feels that I should be able to preview a (re)scheduled change, I just don't see how given the current API

#

(without changing state, i.e. applying an actual schedule, previewing, then applying the old schedule in case of cancelling the preview for UX sake)

smoky crag
#

Yeah, I don't think this is possible today without a workaround (like you found). It's valid feedback!

dapper summit
#

I am only afraid of any caveats I am not seeing... there shouldn't be any though right? I think I'm thinking correctly.

Given that a downgrade (for us) only happens at the end of the current subscription period, proration is always 0, as there is not credit left, it's always spent (in other words there is no proration).

Ah, but what if there is a permanent discount applied to the existing subscription?

#

Well I guess I could always "migrate" options from the current subscription to the preview

smoky crag
#

Yeah you'd just apply the same discount to the preview I guess

dapper summit
#

Ok. I'll need to check with business what behavior is actually intended. Well thank you for your time 🙂

smoky crag
#

of course, np!