#Cjones - metered billing prices
1 messages · Page 1 of 1 (latest)
Hello, do you have an example ID of a Subscription that saw this price doubling? (sub_123)
Thank you, will check in to that subscription in a minute
Hey, apologies, the server got pretty busy and I accidentally dropped off of this thread. Looking in to this subscription now
ok thanks
Do you have the snippet of your code where you are logging usage here?
const usageRecord = await stripe.subscriptionItems.createUsageRecord(
subscription.items.data[0].id,
{
quantity: Math.round(usageQuantity),
timestamp: new Date(new Date().toUTCString()).getTime() / 1000,
}
);
does this help?
some of the billings doubled in price
Can you explain what you mean here? ie, where am i looking at this example
This looks like a subscription created just yesterday:
https://dashboard.stripe.com/logs/req_HJTIAyoIScwgZd
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
yes it was created yesterday
May 11, 2:30 PM
1840
May 11, 2:30 PM
920
920 was the original value
You seem to be sending a lot of invalid usage record requests:
https://dashboard.stripe.com/logs?method[]=post&method[]=delete&path=%2Fv1%2Fsubscription_items%2F*%2Fusage_records&direction[]=self&direction[]=connect_in
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
but i am looking for the requests that incremented that subscription item
Ok, yes, you made two requests for this subscription item:
https://dashboard.stripe.com/logs/req_nYcbPrjYoIWU0e
https://dashboard.stripe.com/logs/req_gWXUgDQbI2nkRH
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
You increased by 920 each time, so this result is expected
You'd need to review and debug your code to explain that, these requests came from your server
ok thanks
We merely incremented the usage according to the amounts you sent
right that makes sense
if we want it to use only the latest value
not increment
is there a different call for that
Yes, that's a different way of tracking usage
https://stripe.com/docs/products-prices/pricing-models#reporting-usage
The default value for the action parameter is increment. This value assumes that the price is configured with aggregate_usage=sum and that you write usage as it occurs, passing it to Stripe with the current timestamp.
A set value for the action parameter supports the case where you aggregate usage yourself, and configure the price with aggregate_usage=last_during_period or aggregate_usage=last_ever.
ok, last ever would be the last usage even from the previous cycles
so it would hold the value from the last update even if it was 2 cycles ago ?
Yes, the aggregate would be the last value set, in that case
so it depends on your pricing model
ok, otherwise for metered billing it will reset to 0 when the new billing cycle starts ?