#dyson

1 messages · Page 1 of 1 (latest)

peak heronBOT
scenic bane
#

When you say remove prorations from your subscription, do you mean you have a subscription with existing prorations or just that you are trying to avoid prorations when making future changes to your subscriptions?

#

Do you have a request ID (req_123) from a time you saw this behavior?

warm maple
#

since it is a licensed subscription, proration is default whenever the user wants to change tiers, but i want to remove all proration discounts when they try to change, so I want to remove prorations on the subscription's creation

#

i am currently doing so during a "checkout.session.completed" event

warm maple
scenic bane
#

I was asking for an ID from when you are making that subscription modify call

scenic bane
warm maple
scenic bane
#

That does sound like what proration_behavior='none' should do. Do you have the ID of a subscription that you modified this way that got prorations anyways (sub_123)?

warm maple
scenic bane
#

Or a request ID would be more direct

#

Yep one sec

warm maple
#

req_y1KxnTHzfAVkyG

#

full code that is being used to make the modify call is

customer = stripe.Customer.retrieve(
    "cus_1234",
    expand=["subscriptions"],
)

subscription = stripe.Subscription.modify(
    customer['subscriptions']['data'][0]['id'],
    proration_behavior='none',
)
scenic bane
#

Oh I got it. One sec looking at that subscription

#

Actually, I don't see any prorations on that subscription that you made the call in in that request

#

Can you explain more about what that call was trying to do? I may have misunderstood what you were saying before

#

If you make that call and pass in an items array, it should make those modifications without any proration

#

Oh and the other thing to keep in mind is that your code with items would add all three items to the existing subscription

  {'price': 'price_1234'},
  {'price': 'price_1235'},
  {'price': 'price_1236'},
]

subscription = stripe.Subscription.modify(
  session['subscription'],
  items=items,
  proration_behavior='none'
        )```
Basically any item is assumed to be something you want to add unless you give it the `id` of an existing subscription item, in which case we modify the existing subscription item to have that new price
warm maple
#

or do i need to pass in an items array of id price pairs

#

the exact work flow is on checkout, get the new subscription that has been made, and remove prorations entirely

#

to the test i make a stripe.billing_portal.Session and then in there is where i see

#

which should be $5 instead of 0

#

this is downgrading from the $10 account

#

upgrade is siimilar

scenic bane
#

I am a bit confused by those two examples. Can you send me the checkout session from the first screenshot?

#

And Checkout can't do upgrades/downgrades as far as I know, where exactly did that second screenshot come from?

warm maple
#

its not chekcout, its a billing portal

#

to manage subscription

warm maple
scenic bane
#

So you need to retrieve the subscription's items and pass the ID of the item that you want to switch to the new price

warm maple
#

so then

#
items = [{'id': subscription['items']['data'][0]['id'], 'price': priceForSubscriptionTier}]
``` is what i want
scenic bane
#

Yes, that looks like it should work on one item subscriptions. Are you seeing the results you want in test mode?

warm maple
#

it is not, when running the testing code

customer = stripe.Customer.retrieve(
    "cus_NEJ1PPglSFDcZf",
    expand=["subscriptions"],
)

subscription = stripe.Subscription.modify(
    customer['subscriptions']['data'][0]['id'],
    items=[{
        'id': subscription['items']['data'][0]['id'],
        'price': 'price_1MMbKfJf6Tog4xNzy3LvHNwK',
    }],
    proration_behavior='none',
)

session = stripe.billing_portal.Session.create(
    customer="cus_NEJ1PPglSFDcZf",
    return_url='https://www.example.com'
)

print(session.url)

i get the same prices as the screenshot above

scenic bane
#

Thanks for the info, checking in to that subscription

#

For that subscription I only see $10, no prorations

warm maple
#

how do you see prorations on that page?

#

or lack thereof

scenic bane
#

Though that subscription is already on that price, so modifying it wouldn't change much here

#

They would be listed as things like "unused time on X plan"

warm maple
#

also could the issue be with something other than prorations/ why is the billing portal still showing discounted prices

scenic bane
warm maple
#

ah ok that fixed it, thank so you much for all of your patience and help!