#maranello_
1 messages · Page 1 of 1 (latest)
Hello! Can you give me the request ID showing your latest attempt? Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Hi, here it is: req_ZQ4r1YV1SEJ4J2
Here is the creation payload:
schedule_payload = {
'from_subscription': subscription_id,
}
schedule, error = self._handle_stripe_exceptions(
stripe.SubscriptionSchedule.create,
**schedule_payload
)
And here is the update payload:
phases_payload = {
'start_date': scheduled_for,
'phases': [{
'items': [
{'price': item['price'],
'quantity': item['quantity']} for item in items
],
}]
}
updated_schedule, error = self._handle_stripe_exceptions(
stripe.SubscriptionSchedule.modify,
schedule_id,
**phases_payload
)
You're trying to set the start_date outside of a phase. The start_date needs to be set inside a phase.
Like this:
phases_payload = {
'phases': [{
'items': [
{'price': item['price'],
'quantity': item['quantity']} for item in items
],
'start_date': scheduled_for,
}]
}
?
You likely want your first phase to have a start_date of now, and your second phase to have start_date for when you want that phase to start.
Yeah, something like that.
Request req_QA7ALUOmwaOkIv: You cannot migrate a subscription that is already attached to a schedule: sub_sched_1O7MAOBQSc48BDFbkfcpb0gC.
How can I delete a schedule from the dashboard? I cannot see it.
I don't know how to do it from the Dashboard, but you can use this API to release the Subscription from the Schedule: https://stripe.com/docs/api/subscription_schedules/release
Request req_VVLBsyYoLeHvdQ: You can not modify the start date of the current phase.
Yeah, that one likely needs to be set to now as I mentioned above, or omitted entirely.
Also, I think you're misunderstanding how this works.
When you specify phases, you need to specify all of them, including the current phase.
You can't just supply a future phase.
Not sure I get it. Where should I mention the start_date? It's not letting me pass it in the payload it because I have a "from_subscription" specified, and it is not letting me pass it in the schedule update. Can you be clearer plz?
When you specify the phases for a Subscription Schedule you need to specify the current phase and any future phases you want. So, for example, if I had an existing monthly Subscription and created a Subscription Schedule for it the Subscription Schedule would have one phase, which describes the current state of the Subscription. If I wanted to adjust the Subscription Schedule to change the Price at the end of the current period I would update the Subscription Schedule and specify two phases. The first phase would describe the current state of the Subscription up until the end of the current period. The second phase would describe the state of the Subscription after the change, beginning at the next period.
I recommed you use iterations to specify how long phases last: https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-phases-iterations
So you're saying I should take the first phase I receive from the response at creation time, and append to that list the new phase which includes the new start_date?
Yep.
You're the man!
But I think it should be clearer in the docs.
or maybe I am too tired
Subscription Schedules are really powerful, but the tradeoff is that they're somewhat complex. 😅
Thanks for your help, have a great one!
You too! Also I recommend you read through these docs if you haven't yet: https://stripe.com/docs/billing/subscriptions/subscription-schedules