#nickdnk - metered upgrade

1 messages ยท Page 1 of 1 (latest)

indigo prawn
#

Hi there. One moment

cyan plinth
#

๐Ÿ‘‹ happy to help, I'm stepping in for my colleague

#

I'm not sure I really follow the question

lunar bridge
#

I have a sub with 3 prices all on metered billing. I need them moved to a new price, with the same metered structure, but a higher price

cyan plinth
#

you just want to update the subscription items?

lunar bridge
#

So I'm thinking I loop the sub, match the price id against the ones I want to replace and update each items price ID. Then for each item I fetch a usage record summary and resolve the highest quantity on there for each item, then update the sub and create 3 new usage records?

#

Yeah that would work for non-metered billing

#

the link, that is

cyan plinth
#

I could test it but I'm pretty sure it would

lunar bridge
#

I think I got it, I'll get back to you if I can't make it owrk

#

I just wanted to make sure there wasn't an easier way

cyan plinth
#

I think if you just update the price for the same item (by providing the id) is the best thing to do

lunar bridge
#

But what will happen to the metered values?

#

Wouldn't they go to 0 for the item?

#

take sub_1LFGtQL7ilRdQXxE8zaT0sNk for example

#

Currently has 4, 2 and 1 as values

#

for ucpoming invoice

cyan plinth
#

I think since proration will be applied

lunar bridge
#

I don't need proration

cyan plinth
#

ok in that case I'm pretty sure the usage would not be affected

lunar bridge
#

Okay I'll try one

#

It totally worked

#

I guess since I was replacing the price and not the item it kept its metered values

cyan plinth
#

yes exactly

#

happy this worked for you

#

let me know if you need any more help

lunar bridge
#

Thanks

#

Yeah no that didn't work for tiered pricing

#

Look here

#

sub_1K1rTxL7ilRdQXxEAFLf6CG1

#

It has the correct quantity, 603, but it says 0 in unit price?

#

Doesn't even make any sense

#

price_1LAD8hL7ilRdQXxExKPaMhp4 is the price

#

it should have 5.5 euro per 100 to begin with

orchid island
#

๐Ÿ‘‹ I'm taking over since @cyan plinth had to head out - let me wrap up a few other threads and I can take a look

lunar bridge
#

Alright. Kind of an SOS though now

#

haha

#

It worked fine for "Active User" and "Identity" but those are not tiered

#

It might be because the top tier is free and it's somehow not correctly applying the bottom tiers

#

Because it did work for this one, which is on the same new price but on a lower tier: sub_1LFGtQL7ilRdQXxE8zaT0sNk

#

It correctly has quantity of 2 at 5.5 each: 11 euro

#

Exact same code updated both subs

orchid island
#

Let me look now

lunar bridge
#

Looks broken to me

#

I have to run the script for all my subscriptions pretty soon as they are currently not updating correctly when users make changes on our end, since it does not find the expected price objects in each sub.

#

So should I try creating a new usage record for the sub and see if that fixes it?

orchid island
#

Give me just a couple more minutes - still looking at something

lunar bridge
#

Sure, I won't change anything until you get back to me

orchid island
#

Was your intention to have each tier applied before moving on to the next one?

lunar bridge
#

My intention was for the sub to remain as-is

#

Just with a new pricing model

#

But it seems ot have applied the highest tier (free) to the full quantity of the item

orchid island
#

That's because price price_1LAD8hL7ilRdQXxExKPaMhp4 has tiers_mode: volume - it looks at the total quantity and then applies the tier that matches

#

Which in this case is the free tier (because the quantity is greater than 200, which is the highest tier that has a unit cost)

lunar bridge
#

I would expect it to apply from quantity 1 and up, similarly to if I created a usage record

#

so how do I fix this? create a new usage record?

#

I would expect it to look like this: sub_JJFcBJ8Dx8qTuT

#

Because the tiers are identical on the new price

orchid island
#

Yeah, but if you look at pl_1EXvSZL7ilRdQXxEjgtYMnY3 it has 'tiers_mode: graduated'

#

That's why they're behaving differently

lunar bridge
#

I don't see that anywhere on the dash though

#

So it's simply because it's completely different price I created

orchid island
#

Yeah - fundamentally you're getting different behavior because the old and new price are different (more specifically, they have different tiering schemes)

lunar bridge
#

Alright, so I can fix this by creating a new, correct one and just migrating them again

#

with the same quantity

#

price_1LIEsnL7ilRdQXxERjJEsRTG would work then

orchid island
#

Yup, I believe that one should work

lunar bridge
#

Yea it's good now: sub_1K1rTxL7ilRdQXxEAFLf6CG1

#

Thanks for clearing that up. I totally missed that there were two types of tiered pricing types

orchid island
#

no worries!

#

Always feel free to use the same thread!

lunar bridge
#

So yea we have some very angry people that have been trying to get their money back for a while

#

And it's taken a looong time

lunar bridge
#

And now the funds are just listed under that "future refunds" section which is not really useful

#

The funds were transferred explicitly to cover this negative balance

orchid island
#

Copying your original question here:
Is it normal for incoming payouts (to cover a negative balance) to not affect an account's balance? acct_18w8yoIFDslEWhBA has -10,150.40 DKK and 11,224.80 DKK under "future refunds or disputes" It's supposed to use those funds to cover pending refunds.

trim thunder
#

@lunar bridge the "future refunds" balance is essentially a holding place for funds to make sure that any refunds that come through are covered first and foremost. If you need to transfer that balance to the existing negative balance, then you'll need to reach out to support and have them review your account to see if that can be done manually from their end.

https://support.stripe.com/contact/email

lunar bridge
#

Alright, but what is the point of not using those funds?

#

I don't understand the use-case for not consuming those immedaitely for pending refunds. It even says "add to balance" to cover the negative balance, which is what we did

#

It also says "Each day, these funds will be used to cover any negative balance on your account."

#

so I should wait 1 daY?

trim thunder
#

I'm not sure. I wish I could help, but this chat is focused on developers and technical questions. Our support team will be able to assist you better than I can: https://support.stripe.com/contact/email