#cho_code
1 messages ยท Page 1 of 1 (latest)
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.
- cho_code, 1 day ago, 101 messages
- cho_ece-setup, 2 days ago, 49 messages
- cho_code, 2 days ago, 14 messages
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1255622653432168491
๐ Have more to share? Add details, code, screenshots, videos, etc. below.
Hello
Yeah if the schedule was released then when you retrieve the Sub subscription.schedule should be null
Have you tested and you are seeing otherwise?
Should be pretty quick to test using Test Clocks: https://docs.stripe.com/billing/testing/test-clocks
I have this subscription: sub_1PDwmCDyFtOu3ZuTt7G1HBvc
See that's what I thought, but I has been some time so I doubted myself
Was there an update that caused a change to subscription scheedules
Yeah that schedule is still active until the next month
I'm revising my code and this bug suddenly started appearing
StripeInvalidRequestError: You can not update a phase that has already ended. Trying to update phase 0.
This error wasn't present with the same code, shall I provide the snippet?
My system correctly identifies the current phase as '1'
Yeah so the Subscription Schedule had a phase 0 that ended on June 21 and those requests are made afterward
Are you retreiving the current state of the schedule before performing any updates?
You can't just pass in the same parameters from the original creation
is that incorrect?
It has to be current
how can I send a code block here
๐งโ๐ป How to format code on Discord
Inline code: wrap in single backticks (`)
This:
The variable `foo` contains the value `bar`.
Will turn into this:
The variable
foocontains the valuebar.
Code blocks: wrap in three backticks (```)
Also, you can specify the language after the first three backticks to get syntax highlighting.
This:
```javascript
function foo() {
return 'bar';
}
```
Will turn into this:
function foo() {
return 'bar';
}```
Notes about **code blocks**:
- Specifying the language is optional (e.g., you can omit `javascript` in the example above)
- If you don't specify the language you won't get syntax highlighting
- When you're inside a code block (after you type \`\`\`) the `Return`/`Enter` key will add a new line instead of sending your message
- Once you end the code block `Return`/`Enter` works normally again
You can [read more about message formatting on Discord's website.](https://support.discord.com/hc/en-us/articles/210298617)
(
phase: Stripe.SubscriptionScheduleUpdateParams.Phase,
index: number
) => {
return {
items: phase.items.map((item: any) => {
return {
price: item.price,
quantity: item.quantity,
};
}),
currency: phase.currency,
description: phase.description,
iterations: phase.iterations,
...(index === 1
? {
end_date: new_end_date_epoch,
trial_end: new_end_date_epoch,
proration_behavior: 'none',
}
: {
end_date: phase.end_date,
start_date: phase.start_date,
}),
// Add any other properties from the phase object as needed
};
}
);```
oof the tabbing isn't good
I did run into the issue of not being able to just map that 1st phase 1:1
Ah yeah you can't do that
D:
That will map all of the phases
right
You need to check the current_phase: https://docs.stripe.com/api/subscription_schedules/object#subscription_schedule_object-current_phase
And then only map those that are that phase and after when making an update
OHHH
okay this is omega simple for my use case
our schedules only have up to 2 phases and then releases
So I would only map index 1
which is the same as returning not mapping
๐
okay it worked
I just needed to set the start date to the start date of phase 1 and return just the single map
ty ty