#maranello_

1 messages · Page 1 of 1 (latest)

prime craterBOT
clever oar
graceful ivy
#

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
)

clever oar
#

You're trying to set the start_date outside of a phase. The start_date needs to be set inside a phase.

graceful ivy
#

Like this:
phases_payload = {
'phases': [{
'items': [
{'price': item['price'],
'quantity': item['quantity']} for item in items
],
'start_date': scheduled_for,
}]
}
?

clever oar
#

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.

graceful ivy
#

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.

clever oar
graceful ivy
#

Request req_VVLBsyYoLeHvdQ: You can not modify the start date of the current phase.

clever oar
#

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.

graceful ivy
#

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?

clever oar
#

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.

graceful ivy
#

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?

clever oar
#

Yep.

graceful ivy
#

You're the man!

#

But I think it should be clearer in the docs.

#

or maybe I am too tired

clever oar
#

Subscription Schedules are really powerful, but the tradeoff is that they're somewhat complex. 😅

graceful ivy
#

Thanks for your help, have a great one!

clever oar