#stealth2352

1 messages · Page 1 of 1 (latest)

spring orbitBOT
#

Hello stealth2352, we'll be with you shortly! Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
https://discord.com/channels/841573134531821608/1163881938726178888, 1 days ago, 3 messages

dense sky
#

hello! there's no such event, however, is there a reason why you're looking for such an event? can you share more?

young reef
#

Yeah. So I configured yearly subscription to create invoice when threshold is reached ("Reaching an unbilled pre-tax total of €50.00 will trigger a new invoice"). However, it never actually bills those invoices. They go into "pending invoice" queue and just wait there. Unless I CreateInvoice manually they will wait there for entire year until next billing cycle. I would like to trigger creation of those pending invoices as soon as threshold is reached.

dense sky
#

can you share the subscription id for me to take a closer look?

#

but it'd be ideal if you can share the subscription for me to take a look to confirm

young reef
#

sub_1O2MRzGpJlO3RAQZQeZ0EKDn

#

Yeah, I saw "invoiceitem.created" but the problem with this event is that it is being sent twice and is thus not very reliable. It sends two events for each change - adds remaining balance, and takes away new balance.

dense sky
#

gimme a while to think about this

#

i think the invoiceitem.created event would still work. The way I would go about it is to listen for that event, then run a cron job once a day to generate a invoice for any customers that have pending invoice items

young reef
#

Yeah. That's where I am headed right now. I was hoping to avoid cron jobs.

#

Thanks anyway.

#

On a side note, I think there's a bug with clocks and draft invoices.

#

in_1O2Os2GpJlO3RAQZ1ltNUdGd was supposed to be finalized and charged 10/24/23, 2:13 AM. My test clock is at "The clock time is October 25, 2023 at 2:20 AM GMT+2". Invoice is still in draft.

dense sky
#

sometimes you may need to advance the test clock a few more times (or a bit more), see if that works

young reef
#

That worked. Thanks.

dense sky
#

@young reef the threshold usage : https://stripe.com/docs/api/subscriptions/object#subscription_object-items-data-billing_thresholds-usage_gte should only be applicable to usage_type=metered billing. And right now, you're using usage_type=licensed

If you switch to usage_type=metered, it should automatically bill / invoice upon reaching the threshold