#nachofranco14-sub-update
1 messages ยท Page 1 of 1 (latest)
Hey, you can control that to work however you want. What is the desired behaviour and what have you tried so far?
I'd like to override the items that are in the subscriptions with a new list of items
Sure, then you'd just pass a list to the items parameter in your update call with just the new items: https://stripe.com/docs/api/subscriptions/update#update_subscription-items
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
they need to be all new, right?
Well you'll likely have at least 1 existing subscription item, so you'd need to pass the si_xxx ID of that one with the new price_xxx
look at this request: https://dashboard.stripe.com/test/logs/req_P2bBlAgWeocHbq
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
it didn't replace the items but added them
Yep, you need to pass items[]id: 'si_xxx' for the Subscription Item you want to change
that's not the same
as I told you
I want to replace the items with a new list of items
is that even possible?
Then you'd pass items[]id and items[]deleted: https://stripe.com/docs/api/subscriptions/update#update_subscription-items-deleted
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Which is basically the same as what I originally told you to do
so:
- I query the current items
- I update the subscription with the new items
- I delete the old items
would that work?
Yup. Or you can just update the existing si_xxx items with the new Price objects. Either works!
that's not optimal because there could be changes to the vat_rate as well
and what's the difference between
stripe.SubscriptionItem.delete(sid)
and stripe.Subscription.modify(subscription_id, items={"id": "sid", "deleted"=true})
?
Nothing really it's just a different endpoint for a single task
You'd still need to call the update endpoint too in your example, so you're better off just doing that
Otherwise you'll end up with 1+n requests as opposed to just 1
I've been trying it out, seems like it will work, will update you once it arrives to the sandbox env ๐
now I have another question @dreamy shale
are you still there?? or should I ask @fickle anchor ?
cool
thank you
we were talking about subscriptions items update
I managed to override the items
but the removed items are creating prorations on the current invoice
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
and the upcoming invoice of the subscription https://dashboard.stripe.com/test/subscriptions/sub_1LG3SVBEDYDqpisuBbgToGIO
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
how can I prevent that behavior?
Thanks! Give me a few minutes to look into this.
is it fine if I just pass the proration_behavior="none" ?
Sorry for the delay. If you don't want prorations, then yes you should pass proration_behavior="none" during your udpate call.