#Cjones - metered billing prices

1 messages · Page 1 of 1 (latest)

crystal trench
#

Hello, do you have an example ID of a Subscription that saw this price doubling? (sub_123)

jolly jetty
#

yes sending now

#

sub_1KyFcRH9YdMmPsAXyUVrBBxx

crystal trench
#

Thank you, will check in to that subscription in a minute

crystal trench
#

Hey, apologies, the server got pretty busy and I accidentally dropped off of this thread. Looking in to this subscription now

jolly jetty
#

ok thanks

crystal trench
#

Do you have the snippet of your code where you are logging usage here?

jolly jetty
#

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?

tardy shale
#

some of the billings doubled in price
Can you explain what you mean here? ie, where am i looking at this example

jolly jetty
#

yes it was created yesterday

#

May 11, 2:30 PM
1840
May 11, 2:30 PM
920

#

920 was the original value

tardy shale
#

but i am looking for the requests that incremented that subscription item

#
#

You increased by 920 each time, so this result is expected

jolly jetty
#

ok so it doubled up

#

what would have triggered this ?

#

it should only run once

tardy shale
#

You'd need to review and debug your code to explain that, these requests came from your server

jolly jetty
#

ok thanks

tardy shale
#

We merely incremented the usage according to the amounts you sent

jolly jetty
#

right that makes sense

#

if we want it to use only the latest value

#

not increment

#

is there a different call for that

tardy shale
#

Yes, that's a different way of tracking usage

jolly jetty
#

ok what is the difference please?

#

ill relay this to the team

tardy shale
#

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.

jolly jetty
#

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 ?

tardy shale
#

Yes, the aggregate would be the last value set, in that case

#

so it depends on your pricing model

jolly jetty
#

ok, otherwise for metered billing it will reset to 0 when the new billing cycle starts ?

tardy shale
#

If you're using sum, the invoice will charge for the usage for the period then you'd track new usage for the next period

#

The total continues to increment, but the new amounts are used in that model

#

where as the max (based on above) is used in those models