#meshpaul_code

1 messages ¡ Page 1 of 1 (latest)

midnight moonBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1220549189209948302

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

surreal stirrupBOT
#

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

south fossil
#

Hi

#

Looks like code didn't make it let me update

#
        val subscriptionId = "sub_1Of9NMBZuRENdfSAYdQ77jsc"
        val subscription = Subscription.retrieve(subscriptionId)
        val subscriptionItem = subscription.items.data.first { it.price.id == MONTHLY_COLLECTION_PRICE_ID }

        val paramsNew = SubscriptionItemUpdateParams.builder()

        paramsNew
            .setProrationBehavior(SubscriptionItemUpdateParams.ProrationBehavior.NONE)
            .setQuantity(subscriptionItem.quantity - 1)

        subscriptionItem.update(paramsNew.build())
arctic prism
#

req_xxx

south fossil
#

I had 3 items then I set this to 2

#

let me set this to 1 and show you the log

#

when I see invoice I see very weird behavior due to proration

arctic prism
#

It seems like you are updating the Subscription Item? Let's try to Update the Subscription instead

south fossil
#

Tried that as well

#

let me update code related to this

#

Ok let me increase the number of Items first

#
        val subscriptionId = "sub_1Of9NMBZuRENdfSAYdQ77jsc"
        val subscription = Subscription.retrieve(subscriptionId)
        val subscriptionItem = subscription.items.data.first { it.price.id == MONTHLY_COLLECTION_PRICE_ID }

        val params = SubscriptionUpdateParams
            .builder()
            .addItem(
                SubscriptionUpdateParams.Item.builder()
                    .setId(subscriptionItem.id)
                    .setQuantity(subscriptionItem.quantity + 1).build()

            ).build()

        subscription.update(params)

Adding Items

#
         val subscriptionId = "sub_1Of9NMBZuRENdfSAYdQ77jsc"
        val subscription = Subscription.retrieve(subscriptionId)
        val subscriptionItem = subscription.items.data.first { it.price.id == MONTHLY_COLLECTION_PRICE_ID }

        val params = SubscriptionUpdateParams
            .builder()
            .setProrationBehavior(
                SubscriptionUpdateParams.ProrationBehavior.NONE 
            )
            .addItem(
                SubscriptionUpdateParams.Item.builder()
                    .setId(subscriptionItem.id)
                    .setQuantity(subscriptionItem.quantity -1 ).build()

            ).build()

        subscription.update(params)

Log line
https://dashboard.stripe.com/test/logs/req_a7mYyXd9loWuEn

arctic prism
#

Okie looking...

#

Umm this is hard to track because there are too many requests. Could you create a brand new Subscription and then only call 1 Update Subscription API?

south fossil
#

I am not sure we can see this behavior on barnd new

#

let me find another one

arctic prism
#

Yeah this doesn't have proration on Upcoming Invoice, so I think proration_behavior = none is working as expected

south fossil
#

Hmm Ok... we will test this some more... I did start this with subscription first

arctic prism
south fossil
#

that is right

#

I remember clearly setting proration to NONE first then decrementing quantity

#

that was for previous subscription

#

Thank you for now... Will do more testing later