#standeman_code
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/1287792242542641333
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
- standeman_best-practices, 3 hours ago, 12 messages
Hello
You need to put the current Phase in Phase 0 when you update a Subscription Schedule
Then you would set any update that you want to occur in Phase 1
But I want the phase to be changed not add a new phase
You still have to input the current phase as phase 0
Then you make your updates from there
I have a subscription schedule that I created by adding the current subscription and at the end of the subscription period a downgraded version of the subscription. I want this downgraded versio nto be changed.
That is how Subscription Schedules work
This is how I make the phases now:
current_phase = {
"items": [
{
"price": item['price']['id'],
"quantity": item['quantity']
} for item in stripe_subscription['items']['data']
],
"start_date": stripe_subscription.current_period_start,
"end_date": stripe_subscription.current_period_end,
}
# Prepare the new phase
new_phase_items = []
# First, add all current items that are not being changed or deleted
changed_item_ids = set(item['price'] for item in items if 'deleted' not in item)
for item in stripe_subscription['items']['data']:
if item['price']['id'] not in changed_item_ids:
new_phase_items.append({
"price": item['price']['id'],
"quantity": item['quantity']
})
# Then, add or update items from the 'items' parameter
for item in items:
if 'deleted' not in item:
new_phase_items.append({
"price": item['price'],
"quantity": item['quantity']
})
# Prepare the phases for the schedule
phases = [
current_phase,
{
"items": new_phase_items,
'iterations': 1
}
]