#kamran5446

1 messages · Page 1 of 1 (latest)

near pagodaBOT
hidden blade
#

You can't. When you set proration_behavior, it gets set on the Subscription object, which means it applies to all the Subscription's items

rich garnet
#

import stripe

stripe.api_key = "your_api_key"

subscription_id = "sub_xxxxxxxxxxxxxxx" # replace with your subscription ID
item1_id = "si_xxxxxxxxxxxxxxx" # replace with the ID of the first item in the subscription
item2_id = "si_yyyyyyyyyyyyyyy" # replace with the ID of the second item in the subscription

Modify the first item with proration_behavior="create_prorations"

stripe.SubscriptionItem.modify(
item1_id,
proration_behavior="create_prorations"
)

Modify the second item with proration_behavior="none"

stripe.SubscriptionItem.modify(
item2_id,
proration_behavior="none"
)

isn't this possible?

hidden blade
#

Are you just trying to update the Price on the Subscription? Can you provide way more detail about what you're trying to accomplish?

rich garnet
#

i am trying to update quantity

hidden blade
#

On one item? On both?

rich garnet
#

both

hidden blade
#

Okay, and how are you wanting to handle prorations?

rich garnet
#

i have scenerio which i need to set different proration_behavior to both item

hidden blade
#

Can you please be more specific?

rich garnet
#

i have one item for which i am decreasing quantity so i want to set proration_behavior to none
and i have other item for which i am increasing quantity for which i want to set proration_behavior to 'always_invoice'

hidden blade
#

If you make separate API calls for each Price (e.g. 1 api call to update Price 1 with proration_behavior: 'none', 1 api call to update price 2 with proration_behavior: 'always_invoice'), does that have the desired effect? When you use proration_behavior: 'always_invoice', a new Invoice is immediately created, so I would recommend doing that one 2nd (e.g. in the order I mentioned above)

rich garnet
#

alright then its possible to achieve that?