#ironbeard - update subscription

1 messages ยท Page 1 of 1 (latest)

wicked fern
#

Hello! Just starting a thread for you -- I'll review and respond as soon as I can ๐Ÿ™‚

#

hey again ironbeard ๐Ÿ‘‹

steady rivet
#

take your time

#

hey again ๐Ÿ™‚ thanks for all your help

wicked fern
#

to add new items, you only need to send those

#

to update existing items you need to specify the subscription item id of the existing ones

#

wihtout an id and update item entry is considered new

steady rivet
#

Gotcha. So I think in my case the only situations would be adding new items (so only send those in the update call) but also cancelling potentially one of many items. Would that be done in a delete call? I'd want the subscription to persist (assuming there's still prices that weren't cancelled)

#

or do I send an update with an id of the removed item and a quanity of zero?

wicked fern
steady rivet
#

Gotcha. And if I always use proration_behavior='invoice_always' it will charge the prorated amount when the update call is made, right? Not at the next billing cycle?

#

with, I suppose the exception of when deleting an item, it would offer credit on the upcoming invoice

wicked fern
#

Hmm let me poke at this a bit, updating using the id and quantity 0 might work here ๐Ÿค”

steady rivet
#

I think it makes sense to just delete the subscription item, I think I'm okay with that workflow unless you see some reason that updating quantity zero would be better

wicked fern
#

Only because of the always invoice hevaiour -- you might wish to update to 0 quantity to invoice first, then delete it

#

oh right

steady rivet
#

Ohh, I see. But I suppose when I'm deleting an item, I wouldn't want it to invoice immediately (as there would be nothing to charge?), it should just be applied as credit to the next bill, right?

wicked fern
#

yep that's right - in that case using the delete api directly works fine ๐Ÿ™‚

#

(you could also use update sub with deleted -- will have the same result)

steady rivet
#

If I use update (with deleted=True in the item object), is it okay to use the price id instead of the SubscriptionItem id?

#

oh, I guess you kind of said that earlier "without a SubscriptionItem id, an item is considered new", right? I guess my issue is I'm storing Price Ids of a user's subscriptions locally on the Customer, not the SubscriptionItem ids. So I'd need to fetch all SubscriptionItems and compare their price ids to the ones I want to delete, then use the correct SubscriptionItem IDs in a modify call with delete=True?

wicked fern
#

Yea to update/delete you need that item id

steady rivet
#

cool cool. Okay! Should be good for now. I have another question about my workflow, but I need to implement some other stuff first. Have a great day ๐Ÿ™‚

wicked fern
#

Great! yea feel free to drop by again when you get to the next piece ๐Ÿ™‚