#nobodylovesm3-usage-record

1 messages ยท Page 1 of 1 (latest)

random patio
proper violet
#

I'll check if we can reduce usage, but for already charged items, what could also work is to make a refund: apply it as a discount on the next month, or partially refund the previous month charge.

random patio
#

Hi ๐Ÿ‘‹ I'm not sure I understand the scenario. Would you mind clarifying? If the subscription is progressing to the next billing period, then yes usage will reset.

long flame
#

Let's say we have a system that creates a basket with fruits - you can have up to 10 fruits per basket and unlimited baskets

#

once you create a basket with 5 fruits, we send to Stripe that the user has used "5" fruits thus increasing the quantity

#

1 month passes, the user pays XX amount

proper violet
#

@long flame if I'm correct, you are correcting a user's usage from the previous cycle, in the new cycle, right ?

long flame
#

but decides to edit the basket, makes it 7 fruits - we need to send those 2 to Stripe, and if he changes it to 3, we would send -2 (so he must be refunded the amount for those 2 fruits)

proper violet
#

I would recommend you to simply partially refund the previous cycle's charge.

random patio
#

Sounds like you might want to be using Licensed usage instead of Metered

long flame
#

@proper violet i will look into this

#

@random patio not really because we would like to have tiers as well and pricing to be based on quantity

#

or perhaps i don't understand it clearly, i'll look into that as well

random patio
#

We have that as an option also, it's our Graducated pricing model.

long flame
#

and the payment has to be at the end of the period*

random patio
#

Ah, only metered does that.

long flame
#

yes. so I'll resort to refunds then, I guess, thanks

#

i forgot to ask about the other case - to edit the current cycle's usage, is that possible? because i saw that only "action: increment" is available for metered billing @random patio

random patio
#

That's going to depend on what recurring.aggregate_usage is set to on your Price:
https://stripe.com/docs/api/prices/create#create_price-recurring-aggregate_usage

If it's set to sum then you can only use increment
https://stripe.com/docs/api/usage_records/create#usage_record_create-action

But if you're using last_during_period or last_ever then you can use set to set the current usage rather than only being able to increment.
https://stripe.com/docs/products-prices/pricing-models#reporting-usage

long flame
#

it's sum, yes ๐Ÿ˜ฆ

#

so there's no option to reduce it but have to use refunds here as well?

proper violet
#

I think it's pretty worth it for you to rewrite a bit of code to use last_during_period rather than sum.

#

This will be better for handling your refunds issues for current periods, with refunds in last resort in case the cycle is over !

long flame
#

I see, thanks

random patio
#

Refunds/customer credits are an option. But you can also intercept the invoice when it gets created as there is a 1-hour delay before they finalize. You could then manually update the invoice to adjust how much it bills for.