#Lev Chepiga-sub-metered-usage
1 messages · Page 1 of 1 (latest)
sub_1LBESMHKtLNIE75b1xVuLy7g
Taking a look
Specifically for this invoice: https://dashboard.stripe.com/test/invoices/in_1LBFGVHKtLNIE75bmWk7aAfM ?
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
it was one usage session
which generated 1027 records
and triggered invoice creating by threshold twice
finally stripe created usage 1028
So here's the usage records for that particular subscription item in that period: https://dashboard.stripe.com/test/subscription_items/si_Lt0TZ2mE6Ht5cb/usage_records
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
As you can see, they total 1028
Trying to find the API requests records that made them
yes
i watched this logs before
didnt found any useful, unfortunately
thank you for helping
Still looking into this, but my expectation is that the records match the API requests you made to us
if you can find this logs, it will help me specify the problem
because it always 1 record higher
looks really strange)
Yep, checking on it now
Are you reporting usage via the API or Dashboard directly?
Can you share the code that makes that request?
here usage creates with quantity 1 all the time
overall its aws sqs fifo queue where i put all events, and this queue were handling by lambda which working with stripe API
Ok, found the records. Difficult to pinpoint a single issue as there are many, many requests (seemingly incrementing usage by 1 each time?)
Is it possible for you to batch these usage reports into a single daily job? Perhaps you're not correctly accounting for some of the requests – a lot of them are sent milliseconds apart
yes
in that case 1 by 1
its unusual load which i trying to handle
because mostly it will be like 100 records for day for 1 subscription
Like perhaps, your addStatisticDynamoDbRecord call fails, the catch block is fired and you revert your local count but don't update the record count at Stripe
so its not necessary to create some daily basis usage reporting only for unusual high load periods
also in that case will be delay before user can see his expenses
thought about that before
didnt found any erros due this
also, before that function, there is another function which incrementing that usage in one record in database, and, in that record, also 1027
Hmm, the issue definitely lies somewhere in your function/code. We've 533 requests for usage records for that specific subscription item
as i see, stripe somehow combine that usage reports to one, even if it have two different reports for 1, stripe shows 1 usage report for 2
maybe it combines incorrectly?
Perhaps because they're being sent at almost identical times. I'm not sure
Is the quantity value always 1 in your code?
This is why I'd recommend batching the usage records and making a single request daily via a queue or something
in that case yes, always 1
Hi! I'm taking over this thread, give me a few minutes to catchup.
hello
ok, thanks
I would suggest the same thing as ynnoj:
I'd recommend batching the usage records and making a single request daily via a queue or something
and if i dont have opportunity to batch them?
From our end everything seems to be OK. So it’s likely your system that might have missed some items in your logs. You’re sending many requests (multiple a second) so it’s possible you failed to log something at some point which is normal as you start to build and scale a system like this