#Vinz
1 messages ยท Page 1 of 1 (latest)
Hi 2 shoes
I have got subscription and subscription_items in my DB. I have written
def update_subscription(self):
try:
stripe.Subscription.modify(
self.subscription.stripe_id,
cancel_at_period_end=False,
proration_behavior=None,
items=[
dict(id=item.stripe_id, price=item.price.stripe_id, quantity=item.quantity)
for item in self.subscription.items.all() if item.quantity > 0
]
)
return True
except:
return False
but there is a proration
hum might be 'none'
I'm not sure I understand. Is there a question in there somewhere?
HI ๐
Is there a particular reason you want to update the quantity at the end of the billing period?
And do you have an example request ID where you made the above request and a proration was generated?
Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
I was doing this with bare quantity and price
but I've been advise to use subscriptionitem id
OK, find it and come back to you
OK, found the problem, was due to a string missing
Ok great. Does it behave as expected now?
Well not really
I'm afraid
here is the req_70vFe1DKBn4V1b
I create a subs for product A quantity 1
I want to modify subs with product B quantity 1
in my DB, no si_xxxx for subscription item since not create with stripe API
how should my items look like ?
You are passing in "" as the value for id in the second item
yep since it is added
Then don't provide an id parameter
OK ! understood
And for a deletion ?
a an item ?
is it possible with Subscription.modify ?
Yup
Nope
๐
In the items array you can pass a boolean deleted parameter: https://stripe.com/docs/api/subscriptions/update#update_subscription-items-deleted