#kennyjack_best-practices

1 messages ยท Page 1 of 1 (latest)

dense estuaryBOT
#

๐Ÿ‘‹ 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/1367069751758684223

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

sour ivy
#

Yeah unfortunately you won't be able to use the subscription_* parameters. You'll need to use this param and set the phases shape so that it 'ends' as you need. There's no specific 'cancel at' param

#

i.e. set phases[][end_date] or phases[][iterations] so that it ends at the end of the period

pulsar trail
#

Is that mean i also can't use subscription_default_tax_rates and subscription_items field ?

sour ivy
#

Exactly

#
pulsar trail
#

I get an error The subscription schedule update is missing at least one phase with a start_date to anchor end dates to

$payload = [
'customer' => 'cus_xxxx',
'schedule' => 'sub_sched_xxxxx',
'schedule_details' => [
'phases' => [
[
'items' => [
[
'price' => 'price_xxxxxx',
'quantity' => 1,
],
],
'iterations' => 12,
],
],
],
];

Invoice::upcoming($payload)

#

I've define the iterations. Do i need to define the start_date and end date?

sour ivy
#

Yes you'll likely need to pass the existing phases as they are

#

That's not specifcally about the preview/upcoming endpoint, but same concept applies

dense estuaryBOT
pulsar trail
#

Ohh, sorry i'm a bit confusing.
I'm not updating the subscription schedule. I just retrieve the upcoming invoice with phases

sour ivy
#

I know, I'm just sharing that link as the same concept of providing all phases applies to the upcoming invoice endpoint too

pulsar trail
#

Sorry, let me describe my scenario ๐Ÿ™

I currently have a subscription using price_Axxx.
Then, I created a subscription schedule to switch it to price_Bxxx in future.
Now, I want to upgrade the subscription to price_Cxxx instead.

What I want to achieve is to cancel the scheduled switch to price_Bxxx and generate the upcoming invoice that only reflects the price difference between the current price_Axxx and the new price_Cxxx โ€” as if the upgrade is happening directly from A to C, without B in between

For upcoming invoice endpoint, do i need to provide all phases include B ?

dim temple
#

Hey! Taking over for my colleague. Let me catch up.

#

Hi

What I want to achieve is to cancel the scheduled switch to price_Bxxx and generate the upcoming invoice that only reflects the price difference between the current price_Axxx and the new price_Cxxx
If the change was taken into account in the Subscription (billing period started... proration generated) you can't undo that update

#

One workaround is to delete the Subscription and create a new one with price_Axxx and then make the update to price_Cxxx