#anguy95-usagerecords

1 messages · Page 1 of 1 (latest)

midnight pagodaBOT
limpid ice
#

Can you share an example request or object ID?

#

anguy95-usagerecords

compact gale
#

Here is the response with the curl:

{
  "id": "mbur_1M5ZXIIPAPArjjmjF7akMLUa",
  "object": "usage_record",
  "livemode": false,
  "quantity": 23,
  "subscription_item": "si_MpDUpbx83vuKkz",
  "timestamp": 1668797016
}
limpid ice
#

Thank you! Let me take a look

compact gale
#

Thank you

limpid ice
compact gale
#

So do i have to pass in a previous time stamp with the set action?

limpid ice
#

Yes, the "set" is referring to setting the usage record for a particular timestamp.

compact gale
#

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 🤔

limpid ice
#

That's definitely strange - do you have an example of one of those usage records that you're making from the dashboard?

compact gale
#

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

long reef
#

@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

compact gale
#

hey @long reef , i tested curl, cli, node, and dashboard and same result

long reef
#

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

compact gale
#

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"
}%
long reef
#

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

compact gale
#

So we have to store the time stamp we pass into createUsage?

long reef
#

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

compact gale
#

Okay, thank you for your help. Let me try to change up my code and see if that helps

compact gale
#

@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'

torpid estuary
#

Hi there. koopajah had to head out unfortunately. Glad to see you found the issue

#

Anything else you need help with?

compact gale
#

I think that would be it for now. thank you very much