#paulpayen

1 messages ยท Page 1 of 1 (latest)

radiant badgerBOT
spare path
#

hi @regal root

regal root
#

hi there! not really I think, can you talk more about the use case?

spare path
#

hum, I have a client that consume something. Then I add this record.
But then , the amount is disputed by the client.

#

So I need to update the value of the record.

#

The business I am working with is :
https://www.switch2zero.com/

I am the lead dev for this company.

The business is to sell carbon offset when a product is bough in a Ecommerce website. Our cilent are ecommerce platform. Each time, they have an order on their ecommerce, switch2zero will invoice them 1% of the order amount to plant Trees.
Then each ecommerce has a subscription based on usage.

#

Each time they have a new order on their ecommerce website, we calculate the amount and we add a usage record.

regal root
spare path
#

?

#

I see

#

With the action = set

#

I see.

#

In Stripe dashboard, what can we see ?

  • each usage records ?
    or
  • a final value ?
#

ALso , in this doc here ;

#

I cannot how the record are given

#

Can I see each records increment ?

regal root
#

you generally see a summary of usage reported over the period. We don't expose individual usage reports(because there can be so many)

spare path
#

ok, so Just the final value.

regal root
#

well it's more along the lines of "Sep 19 2022, 3072 usage was reported", you just can't see the exact individual records that made that up or when they were specifically reported

spare path
#

in the object :
"data": [
{
"id": "sis_1DkWqo2eZvKYlo2Cs4NSCMMw",
"object": "usage_record_summary",
"invoice": "in_1DkWqo2eZvKYlo2Cghtks5xk",
"livemode": false,
"period": {
"end": null,
"start": null
},
"subscription_item": "si_18PMl42eZvKYlo2CGduFchWC",
"total_usage": 1
},

The final value will be inside "total_usage" ?

regal root
#

yes

spare path
#

๐Ÿ‘

#

ok ;

#

So to conclude,

  • When I have a new usage to add, I use increment
  • When I have something strange that happened (like an order refunded in a ecommerce website), I get the "total_usage" of "usage_record_summaries" and I SET a new value for the usage.

#

Just one question maybe I can do a negative "increment" ?

regal root
#

I don't think so, I think negative use cases are the same, you have to instead set to an updated value(which likely means you need to keep track of exact usage on your side)

spare path
#

an increment with a quantity = -1

#

ok

#

about the quantity , is that a INT or it can be a float ?

regal root
#

it's an integer

spare path
#

ho!

#

ok

#

ok , I might need your help to design

regal root
#

sure, did you have a specific question?

spare path
#

thanks

#

huumm

#

I need to think a bit more and will come back with another question ๐Ÿ™‚