#paulpayen
1 messages ยท Page 1 of 1 (latest)
hi @regal root
hi there! not really I think, can you talk more about the use case?
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.
I don't believe we really support that, you can't change already reported usage.
I think your only option is to use set behaviour to set the current usage to a new computed value https://stripe.com/docs/api/usage_records/create#usage_record_create-action
?
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 ?
you generally see a summary of usage reported over the period. We don't expose individual usage reports(because there can be so many)
ok, so Just the final value.
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
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" ?
yes
๐
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" ?
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)
an increment with a quantity = -1
ok
about the quantity , is that a INT or it can be a float ?
it's an integer
sure, did you have a specific question?