#kennyjack_best-practices
1 messages ยท Page 1 of 1 (latest)
๐ 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.
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
Is that mean i also can't use subscription_default_tax_rates and subscription_items field ?
Exactly
You'd need to update the phases and use the corresponding params:
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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?
Yes you'll likely need to pass the existing phases as they are
You need to pass in all current and future phases when you update a subscription schedule
https://docs.stripe.com/billing/subscriptions/subscription-schedules#updating
That's not specifcally about the preview/upcoming endpoint, but same concept applies
Ohh, sorry i'm a bit confusing.
I'm not updating the subscription schedule. I just retrieve the upcoming invoice with phases
I know, I'm just sharing that link as the same concept of providing all phases applies to the upcoming invoice endpoint too
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 ?
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