#ajaykevin_code
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1486989769274822677
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
i need to sum all the usage of a product and add it to the billing
@hard flameCould I check what sort of products are you referring to?
Do you mean a Metered Product?
If so, then the Billing Meter needs to be set up in a way that allows that to be possible. E.g. default_aggregation: { formula: 'sum' },
const meter = await stripe.billing.meters.create({
display_name: 'Product Usage',
event_name: 'product_usage',
default_aggregation: { formula: 'sum' },
});
After which you can list event summaries like this:
const summaries = await stripe.billing.meters.listEventSummaries(
meterId,
{
customer: customerId,
start_time: Math.floor(new Date('2026-03-01').getTime() / 1000),
end_time: Math.floor(new Date('2026-04-01').getTime() / 1000),
}
);