#admin1
1 messages · Page 1 of 1 (latest)
Hi there!
Can you share the request ID (req_xxx)? Here's how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Hey! Taking over for my colleague. Let me catch up.
sure
Thanks for sharing.
The error message looks explicite:
You can not update a phase that has already ended. Trying to update phase 0.
You are modifying the start date of the first phase: actually the start date is at2022-10-14 08:20:07 +0000 (1665735607)in your request you are passing1665735353
You need to pass the same start date to the request which should be 1665735607
but in the phase why the expired plan is listed ?
if you see the end date for the phase one it is expired
and the my current plan which i have upgraded is in the phase two
but in the phase why the expired plan is listed ?
it's expired yes but it is something that define the subscription_schedule, so need to keep it
when doing further update, and you can't modify it as it's expired as you mentioned
ok so can you tell me how can i modify the subscription now
what will be the proper way
As I mentioned above, you need to set the right start date of the first phase in the update request.
You need to pass the same start date of the phase 0 which should be
1665735607and not1665735353
so i need to pass that phase 0 and in the phase 1 the current plan which i want to continue till its expiration and in the phase 2 the new plan that i want to schedule right?
Yes exactly
I think the error is explicit yet again:
There is a gap between phase 0
(1665735353, 1665735607)and phase 1(1665735353, 1697271353).
the start_date of the phase 1 must be the end_date of the phase 0
According to the requestId you shared, the start_date of the two phases are the same 1665735353 is it normal ?
it shound be
let me debug it once kindly help help me with it please
so 1 firstly i have created a subscription
like this
subscription = stripe.Subscription.create(
customer=customer.id,
items=[{"price": data["price_id"],},],
payment_behavior="default_incomplete",
payment_settings={"save_default_payment_method": "on_subscription"},
expand=["latest_invoice.payment_intent"],
)
i am using the django
and then i have downgraded the subscription pass by passing current phase in phase 0 and new phase in phase 1
so my subscription was schedule for update when the current subscription expires
What's the ID of your schedule?
The sub_sched_xxx ID
sub_sched_1Lsj5aCy95Kg2yHQwWVp93hm
And what's the issue exactly?
well can you tell me how can i modify my subscription which has scheduled attach to it
You can't modify a subscription controlled by a schedule. You either:
- Release it from the schedule to modify it directly.
- Update the schedule to reflect the changes you want.
thank you
now can you tell me if i realise the schedule will the current phase how will current phase will behaviour
will it end at expiration?
The subscription will remain in the current state/billing period
It just means any future phases won't occur
thank you
if i were to modify the schedule can i start the new plan stright away with proration behaviour
updated_subscription = stripe.Subscription.modify(
sub_id,
payment_behavior="pending_if_incomplete",
proration_behavior="always_invoice",
items=[
{
"id": stripe_current_subscription["items"]["data"][0].id,
"price": price_id,
}
],
)
like this behaviour i need to modify my subscription
You're confusing yourself here. You say 'modify schedule' then share code to update a subscription
Which is it?
i want this behaviour in modify schedule
Then you're using the wrong API endpoint: https://stripe.com/docs/api/subscription_schedules/update
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
You need to update the phases parameter to reflect what you want to happen
updated_subscription = stripe.SubscriptionSchedule.modify(
stripe_current_subscription.schedule,
end_behavior="release",
phases=[
# only adding the phase for the new plan
{
"start_date": datetime.now(),
# "end_date": stripe_current_subscription.current_period_end,
"items": [
{
"price": stripe_current_subscription.plan.id,
"quantity": stripe_current_subscription.quantity,
}
],
}
],
)
Probably want to pass proration_behaviour: 'always_invoice' too: https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-proration_behavior
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
But overall, it should work. Did you try it?
yes i forgot about the proration
ill try it and let you know
i cannot add the payment behaviour for schedule like subscription
?
No, pending updates aren't possible with schedules
I guess you'd need to release the subscription from the schedule and update the subscription directly
Not sure why you need a schedule if you only have a single phase
this is the case where i want to update the scheduled subscription
so ..
firstly it will have two phases
well it is quite complicated
but i guess i figured out the solution thank you so much for your help.
sure, np
i am implementing the logic and testing all the scenarios if there is any issue ill let you kow