#kirito

1 messages ยท Page 1 of 1 (latest)

sinful lintelBOT
cinder tide
#

subscription_schedule.updated is the best event for being notified when a Subscription Schedule updates (it moving from one phase to the next will update the phases list).

However, you don't need to wait for a Subscription Schedule to move to the next phase before you add another, unless that is a requirement of the business process you're handling, you can queue up as many phases as you like/need.

zealous wind
#

ok, it is just that every 12 month, will have it own configuration (plan, price, metadata), and the customer should be able to change only the next phase

#

so when moving from phase to the other a new default phase would be created base on the previews one.

#

The event.data.object would be of type Stripe.SubscriptionSchedule?

cinder tide
# zealous wind so when moving from phase to the other a new default phase would be created base...

We do not automatically create new phases. If a Subscription Schedule reaches its final phase, then it will execute its end_behavior. That will result in the Subscription being released from (disassociated from) the Subscription Schedule if that is set to release and will cancel the Subscription if it is set to cancel.

So you would need to ensure that there are already multiple phases if you want the Subscription Schedule to remain associated with the Subscription.

zealous wind
#

I do get the compiling error :

#

Argument of type '{ items: Stripe.SubscriptionSchedule.Phase.Item[]; start_date: number; iterations: number; metadata: Stripe.Metadata; }' is not assignable to parameter of type 'Phase'.
Object literal may only specify known properties, and 'iterations' does not exist in type 'Phase'.

#

when I'ma trying to update the SubscriptionSchedule

gilded wind
#

Hi ๐Ÿ‘‹

zealous wind
#

it is a compiler error

#

I'm using node js

gilded wind
#

What version of stripe-node are you using?

zealous wind
#

"stripe": "^11.5.0",

gilded wind
#

Okay so that's the current vertsion

zealous wind
#

yes

gilded wind
#

I'm not seeing iteration either ๐Ÿค”

zealous wind
#

Yeah but if use it with javascript and not type typescript it work.

#

the problem only happen with typescript

gilded wind
#

That makes sense. I'm not sure why iterations are not in the definition for Phase because our API definitely accepts them

zealous wind
#

Maybe some one forgot to add it ๐Ÿ˜‚

gilded wind
#

I am going to raise this internally. Can you share the code you use to create/update the Subscription Schedule?

zealous wind
#

Ok

#

```const subscriptionSchedule = await stripe.subscriptionSchedules.update(id, { phases })````

#

with :

#
      {
        items: [{ oldSubscription.items.data[0].price.id }],
        start_date: starting,
        end_date: ending,
        metadata: oldSubscription.metadata,
      },
      {
        items: [{ price: planId }],
        start_date: ending,
        iterations: 12,
        metadata: newMetadata,
      },
    ]````
gilded wind
#

Okay I have raised the issue internally.

#

Hopefully we get some eyes on it