#anguy95-usagerecords
1 messages · Page 1 of 1 (latest)
Here is the response with the curl:
{
"id": "mbur_1M5ZXIIPAPArjjmjF7akMLUa",
"object": "usage_record",
"livemode": false,
"quantity": 23,
"subscription_item": "si_MpDUpbx83vuKkz",
"timestamp": 1668797016
}
Thank you! Let me take a look
Thank you
Looking at the request that made that usage record (https://dashboard.stripe.com/test/logs/req_qv6EUJB0onGMES) I'm not seeing any timestamp being passed in so it's default to the current timestamp (and therefore creating a new record)
So do i have to pass in a previous time stamp with the set action?
Yes, the "set" is referring to setting the usage record for a particular timestamp.
Interesting. I'll give it a try. Also, it's weird because in the dashboard, ill set the date and time to a previous time that matches a usage in the list and use "set" but that behaves as an increment 🤔
That's definitely strange - do you have an example of one of those usage records that you're making from the dashboard?
Here is the usage record id si_MpDUpbx83vuKkz
As an example I just set the data and time to the last one @ Nov 18, 10:54 AM for example and try to set it back to 20
@compact gale what does the API do?
We don't really touch the Dashboard or work on it so if you only ever use the Dashboard I'd recommend talking to our support team instead for help https://support.stripe.com/contact
hey @long reef , i tested curl, cli, node, and dashboard and same result
I'm going to need a lot more details then
exact request, exact timestamp, what you set before, what you got after
Because if you pass the same exact unix timestamp then it will work
Is there a way to get back the latest usagerecord & its time stamp?
I run this CLI command, but don't see timestamp on there:
❯ stripe usage_record_summaries list si_MpDUpbx83vuKkz
{
"object": "list",
"data": [
{
"id": "sis_1M5ZqoIPAPArjjmjLf7QhoSb",
"object": "usage_record_summary",
"invoice": null,
"livemode": false,
"period": {
"end": null,
"start": null
},
"subscription_item": "si_MpDUpbx83vuKkz",
"total_usage": 558
}
],
"has_more": false,
"url": "/v1/subscription_items/si_MpDUpbx83vuKkz/usage_record_summaries"
}%
not really and I assume you passed the wrong/different timestamp
What I would advise is to do this
1/ Create a Subscription
2/ Create a UsageRecord at timestamp X with quantity 10
3/ Look at summary, see 10
4/ Create a new UsageRecord at same timestamp X with quantity 23
5/ Look at summary, see 23 and not 33
IF you see 23 you know it works fine and the issue you had was a bug with your own code/debugging where you passed a different timestamp likely
So we have to store the time stamp we pass into createUsage?
yes you do if you want to use the SET feature
Most businesses never use SET
because they report usage in real time, like number of emails or minutes of phone call, etc.
SET is quite rare, it's usually to correct a bug/bad report
Okay, thank you for your help. Let me try to change up my code and see if that helps
@long reef, found the issue. The metered usage by default set to sum. needed to create the price and set it as aggregate_usage: 'last_during_period'
Hi there. koopajah had to head out unfortunately. Glad to see you found the issue
Anything else you need help with?
I think that would be it for now. thank you very much