#pterodavtyl
1 messages · Page 1 of 1 (latest)
Yeah afaik that error is accurate. It's because once the invoice is created, the next billing period has already started
invoice.upcoming is a real event. see: https://stripe.com/docs/api/events/types#event_types-invoice.upcoming
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Thank you for your help duchess!
I want to know why I don't see this event anywhere on my test data or my real actual customers
I'm concerned about it because I don't know what will happen when it triggers
Is there a way to test it?
What is the billing period of your subscription? Monthly?
Also what is your setting Upcoming renewal events set to here? https://dashboard.stripe.com/settings/billing/automatic
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
I have monthly for my real users and for some test users, but I also created a few weekly ones to test.
My setting is for 3 days (I changed it Tuesday), 3 days ago.
Ah that's probably the issue
The invoice.upcoming event is only generated for billing periods over a week
See the little info icon at the above link
My info icon says Event will only be created if billing period is longer than 3 days. Settings changes apply immediately unless an event has already been sent for the next billing period.
Ah ok
So, if I change the invoice.created case for invoice.upcoming, it should work?
Yeah but if no invoice.upcoming events are being generated it won't
Can you share the subscription id where you expected that event to be generated?
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
They're being generated
This was sent 7 days before invoice creation because you didn't update the dashboard setting until after
That'll only apply to future
but I can find it on the Oct 19 logs
What do you mean?
Click the above link
That directly links to the invoice.upcoming event
Yes, but I was confused as to why I was not findind it on my logs, but I was only looking for 3 days before
Yep that's why
Ok... so this is basically the last time I have to report usage
Unless I use a cron job or something like that
I'm not an expert and I don't really have experience with cron jobs
Yeah batches are what we recommend in the docs: https://stripe.com/docs/billing/subscriptions/usage-based#report
But up to you on how you want to handle
Batches meaning cron jobs?
Yep
Ok, I will look into it... last question
If I changed my setting on Tuesday, and the real customers are set to be billed on Nov 1
Should I have seen invoice.created events or not?
You mean invoice.upcoming?
Yes, sorry
No worries
invoice.upcoming
Can you share a subscription id?
Gotcha. Yeah you should get invoice.upcoming 3 days out
Looking at the billing period, invoice.upcoming was sent on 9/24 prior to the 10/01 renewal
I think you changed your setting in time
Yes, I did a change in the subscription
To a different product
Is this going to cause issues?
Shouldn't
But generally I recommend you test out all these major changes in test mode before making decisions for live mode
Yeah, I want to test this, but time is running out
Let me check one thing
thanks
Yeah you should get invoice.upcoming 3 days out
You made the update to your setting on 2023-10-24 20:02:32 +0000
That's 8 days prior to renewal
So it's expected you didn't get the event 7 days out. You'll get it 3 days out
Great. So 3 days out is the 29th? or the 28th?
29th
Perfect. I will look into possibly doing a vercel cron job, or use invoice.upcoming
Does the Stripe API complain if I do daily setting for reports?
What do you mean?
You can do that
I'm not exactly sure how it works yet
I just don't want to be flagged as "too many API calls"
Our api only "complains" if you're hitting rate limits: https://stripe.com/docs/rate-limits
So 20 per second
Nope
That's just for files and search api
It's 25 for most operations in test mode
But 100 in live
Please just read that doc though
Will do! Thank you so much for your help
No problem
Is there anyone that I can email to send a praise for your assistance? You deserve an award!
Yep we lock them after some inactivity
If you have follow-up questions, you can message in the main channel
Someone will open a new thread
But you are just too awesome