#Vinz

1 messages ยท Page 1 of 1 (latest)

ruby pantherBOT
wanton ridge
#

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'

rigid shore
#

I'm not sure I understand. Is there a question in there somewhere?

wanton ridge
#

well yes, how to change subscription items quantity

#

at period_end

ripe breach
#

HI ๐Ÿ‘‹

Is there a particular reason you want to update the quantity at the end of the billing period?

wanton ridge
#

Hi

#

Yes it's an upgrade or downgrade

ripe breach
wanton ridge
#

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

ripe breach
#

Ok great. Does it behave as expected now?

wanton ridge
#

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 ?

ripe breach
#

You are passing in "" as the value for id in the second item

wanton ridge
#

yep since it is added

ripe breach
#

Then don't provide an id parameter

wanton ridge
#

OK ! understood

#

And for a deletion ?

#

a an item ?

#

is it possible with Subscription.modify ?

ripe breach
#

Yup

wanton ridge
ripe breach
#

Nope

wanton ridge
#

๐Ÿ˜„

ripe breach