#seventhirteen_api

1 messages ยท Page 1 of 1 (latest)

rugged lightBOT
#

๐Ÿ‘‹ 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/1331785481159049296

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

rugged lightBOT
sharp jolt
#

Hi there, catching up here and gimme a few mins

sharp jolt
#

Hi, this is expected since meter data persist across products. The Meter is tightly-coupled to the Prices, but you have 2 different Subscriptions per Prices here and their Invoices are separated

fallow plinth
#

Hi - thanks for responding ๐Ÿ™‚

so I have only one subscription, which persists - just the products/prices within the subscription are changing (from A to B).

If the meter is tightly coupled to prices, what happens to Product A's charges/invoice after it's replaced with Product B? I don't see those charges in the new invoice.

Is the best solution then to reset the meter to 0 by sending a negative value when products are changed?

sharp jolt
#

Ah I see

#

Sorry was overlooking that you have only one Subscription

#

I wonder why don't you have 2 separated Meter for 2 Prices? The nature of Prices sharing Meters is for them to continuing having the same usage data

fallow plinth
#

^ yes thats exactly what I'd like to happen, but when I switch to product B the invoice does not reflect the charges posted while Product A was in use

sharp jolt
#

Prices A and B are linked to Meter M. I create Subscription X with Product A and log 50 units of usage. The meter summary API returns 50, and the upcoming invoice reflects this. I then replace Product/Price A with Product/Price B in Subscription X.

The upcoming invoice resets usage to 0, but the API still shows 50. I then log 27 units for Product B, and the invoice updates to 27, but the API shows 77.
You mean the Upcoming Invoice here should have remained to 50 and change to 77?

#

I see. If you advance the time (using Billing Test Clock) and see the actual Invoice being created, does it have 77 or still 27?

fallow plinth
#

You mean the Upcoming Invoice here should have remained to 50 and change to 77? - correct, once i swapped to product B I expected the usage to initially be 50, then increase to 77 once i post 27 usage units. I've attached some screenshots

checking that now

#

advancing the clock past the billing period results in this invoice - it is incorrect too

sharp jolt
#

This Subsription has Subscription Schedule too, so it, kinda hard to follow. Could you test again with a pure Subscirption, and share its Id?

fallow plinth
#

yep that request looks right

#

Ok, working on that step by step:

  1. created sub sub_1QkFuMQUG2aWaqxyofaiLGcK , no schedules. Posted 50 units on price price_1QiOU2QUG2aWaqxyy2GxeBfE

upcoming invoice and api requests are correct at 50

#
  1. swap products/prices. req req_ns0LSLpbrV3oz9
#
  1. invoice is wrong (shows 0 usage), api call is correct (shows 50 usage)
sharp jolt
#

Wait, why set the unit price to $0? If you set it to ie. 10$, you would see it multipled by the 50 in Upcoming Invoice, correct?

fallow plinth
#

we're using the flat price only

#

so we determine the tier based on meter volume, but where you fall specifically in the tier (ie unit cost) isn't charged

#
  1. Charge 17 units now that product B is set. invoice shows 17. api call shows 67
sharp jolt
#

Can you share the request id when you change price?

fallow plinth
sharp jolt
#

Looks like you are deleting the first Subscription Item and creating another Subscription Item

#

Can you use the same Subscirption Item Id, but only change its Price?

#

You would want to find the existing Subscription Item Id (from the Subscription) to specify

fallow plinth
#

ok, trying

#

after second post. same issue

sharp jolt
#

Weird because it works on my side

#

Can you try to advance a little bit of time before making the Subscirption Update?

#

Give the API some times (Test Clock) after reporting usage, and before making Subscription Update

fallow plinth
#

ok. doing 2 days between each step

sharp jolt
#

Ummm could you provide the Sub Is and request id for each step? I just tested and it works correctly here, having the old usage reflected on the new Price

fallow plinth
sharp jolt
#

That's really weird. Gimme some time to look at this

#

Thank you for the detailed requests

fallow plinth
#

thank you for the help! Look forward to hearing from you ๐Ÿ™‚

sharp jolt
#

Ah I see, the Price is successfully changed to the new Price, but the usage wasn't updated

#

This sounds like a bug on our end. Let me confirm with my colleague and be back. If this takes too long, feel free to write in Support and mention this Discord thread. We will continue from there

#

My team will take the Supprot case

#

Curious if you test w a normal Price (no tiers, just plain unit amount and quantity), do you see the issue?

rugged lightBOT
sharp jolt
#

Hey @fallow plinth I think I figured it out. Reporting a Meter event takes some time for it to reflect in all Subscriptions. When you reported the first 50 usage to the Meter, please give it some times (actual time, not just advancing Test clock) until you see it's display on Dashboard to the new Price

#

Then you can report the next 39 usage, and wait a while again to see it is applied (50+39) to the new Price