#nadiya_webhooks
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/1339298352218640477
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
- nadiya_upcoming-invoice-event-days, 32 minutes ago, 21 messages
- nadiya_code, 18 hours ago, 14 messages
- nadiya_code, 20 hours ago, 23 messages
*if we subscribe 1 or 2 days before the billing interval and if the X day we set is 3, does it still generate the invoice.upcoming event? or do i miss it for that cycle?
Hi ๐
You cannot use the invoice.upcoming webhook event for this. It's a brittle solution even when you have enough time. In order to show your customers a preview of their upcoming invoice, I recommend using the API instead. You can retrieve an upcoming invoice by specifying a customer and a subscription ID with this API
i needed to list this invoice in the admin portal, so that they know these invoice will be charged soon , and they can verify them.
like, along with other invoices, we'll show this upcoming invoices too (invoices of all the users).
so, i guess it'll be bit tricky / complicated to use the api each time
Hi, taking over as my teammate needs to step away. Let me catch up
How/ what is tricky about this approach? Can you speak more to that?
invoices of all the customers (for a particular date range ) is listed as a table layout for the admin under invoice section
so, for that case, is it ideal to use the api each time for all the cusotmer for upcoming invoices? also we show all the invoices in one page (unless any specific status filter is applied), that means, along with our existing record from the local invoice table.
so, i was using invoice.upcoming to listen for upcoming invoices and store it in the local db (with status as 'preview' for easily identifying)
Yeah, I would recommend making the API call as well: https://docs.stripe.com/api/invoices/upcoming in this use case.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
but isn't this for each customer?
Yes, what is the concern there?
we've to show all the customer's normal invoice + paid invocie + upcoming invoice all in one place. (we'll jsut show it with a different status)
we've this kind of invoice layout (sorry, its just only 1 now ), but in a real case, there will be many here.
we're only in a test phase now, so we'll be adding option to filter by status later
Ok, so where are you blocked/ concerned?
here
You would use the API: https://docs.stripe.com/api/invoices/upcoming in this use case to attain that information to surface in your UI for the upcoming invoice.
If you're asking about the timing of the event, you can test that using your test API key
I'm certain that event gets send
However, as we suggested earlier, you should use the API: https://docs.stripe.com/api/invoices/upcoming
sorry, i don't understand.
you said, i'd to use the api for storing data to local db?
or do you meant to use this api for showing it directly in the UI?
You would make that call, store that information in your database and show it in the UI
So you do not continuously making the same call all day
ok, so the question was "When"
if wasn't listening for invoice.upcoming, i'd have to get all the customer's subscription plans and check for each upcoming invoice (if i use cron job or something)
if i use invoice.upcoming, it'll be fine for recurring subscription invoices, but how about the subscription (first one) created before X days from the actual subscription start date? (btw, i'm using trial )
i've tested this, but the event is not trigerring i guess if the subscription is created before 3 days (i set 3 as the upcoming renewal event days)
is there any field in invoice to know when (datetime) exactly the invoice.upcoming will trigger?
I see what you're asking.
Yeah, you would need to control that as 3 days is the shortest timeline for these events.
You need to create a logic to catch those on your end and use the API to attain the upcoming invoice data
how about this?
No, I do not think so, https://docs.stripe.com/api/invoices/object
so this 3 days at which time? 12 midnight?
Hmm, I would assume it's dependent on the invoice creation
Like whenever you created the invoice, it would be 3 days before that timestamp.
i see, that make sense
I recommend that you look at the example event and confirm as well