#Ravg

1 messages ยท Page 1 of 1 (latest)

light wrenBOT
junior sigil
#

Hi there!

wild grotto
#

Sure! This one: req_hUWbGwiL8LuWrl

#

It's for "test mode"

junior sigil
#

Why do you need a subscription schedule if you only have one phase? You could directly update the subscription itself.

wild grotto
#

I need to replace some subscription items for about 1000 subscriptions, but the changes should happen only tomorrow at midnight, not immediately. So I'm trying to schedule it

#

(The "start_date"="now" was just a test)

junior sigil
#

Got it! The issue in your request is this part: start_date: "now". You need to set the start_date to the existing start date of the subscription (which is not "now")

#

You can find it by retrieving the existing subscription schedule and using the current phases[0].start_date

wild grotto
#

Okay, thanks for the information. I will change that part.
And where can I set that the changes should be applied in the future (tomorrow at midnight)? I thought it was in the first phase's start_date of the Subscription Schedule

junior sigil
#

The very first phase is the current phase of the subscription. If you want to make a change in the future, then you will need a second phase for that (and use the appropriate start_date)

wild grotto
#

Oh I didn't know I had to use a second phase, that's what I missed then.
My doubt now is about what attributes I need to set for the first phase...
In that case, should I set an end_date to the first phase with all the current items, and then on the second phase I set the start_date and the new items?

stoic gale
#

Hey! Taking over for my colleague. Let me catch up.

wild grotto
#

All right! Thank you ๐Ÿ™‚

stoic gale
#

In that case, should I set an end_date to the first phase with all the current items, and then on the second phase I set the start_date and the new items?
Are you talking about update the subscription_schedule ? if so, yes you need to set the end_date of the first phase of the currently items, and add your next phase(s) with new items

wild grotto
#

Okay. So basically this is what I understood and will try to do to schedule changes to subscription items:

  1. create new subscription schedule
  2. update the subscription schedule and set:
    2.1 first phase (current one): add subscription's original start date to "start_date," the current items, and set "end_date" to tomorrow at midnight
    2.2 second phase (new): set the new items and "start_date" to tomorrow at midnight
    Anything I might have missed? ๐Ÿค”
stoic gale
#
  1. you mean creating the subscription_schedule from an existing subscriptionId? if so, yes that's how you can do
wild grotto
#

I tried that and now I'm getting the error "Request req_SBXnpPQIflOlRU: You can not modify the start date of the current phase".

If I don't set the start_date on the first phase then I get error "Request req_mZXRbzq8ridBMe: The subscription schedule update is missing at least one phase with a start_date to anchor end dates to even tho there is a start_date in the second phase (the new one).

I'm doing like this:

    subscription_schedule = stripe.SubscriptionSchedule.create(
        from_subscription=current_subscription["subscription_id"]
    )

    stripe.SubscriptionSchedule.modify(
        subscription_schedule["id"],
        phases=[
            {
                "proration_behavior": "none",
                "start_date": current_subscription["start_date"],
                "end_date": 1664582400,  # tomorrow
                "items": current_subscription["items"],
            },
            {
                "proration_behavior": "none",
                "start_date": 1664582400,  # tomorrow
                "items": items,
            },
        ],
    )

Any clue what could be the issue?

stoic gale
#

Actually, the firs phase need to have the same start_date of the current active phase of the subscription,

wild grotto
#

ohhh I see! I changed that part and it worked!
Thanks a lot!!

stoic gale
#

Glad to hear that you managed to solve your issue ๐Ÿ™‚ Don't hesitate to come back if you have any followup Questions I can help with!