#nadiya_webhooks

1 messages ยท Page 1 of 1 (latest)

wooden cloakBOT
#

๐Ÿ‘‹ 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.

urban depot
#

*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?

ocean goblet
#

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

wooden cloakBOT
urban depot
#

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

bronze pulsar
#

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?

urban depot
#

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)

bronze pulsar
urban depot
#

but isn't this for each customer?

bronze pulsar
#

Yes, what is the concern there?

urban depot
#

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

bronze pulsar
#

Ok, so where are you blocked/ concerned?

bronze pulsar
#

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

urban depot
#

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?

bronze pulsar
#

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

urban depot
#

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 )

urban depot
#

is there any field in invoice to know when (datetime) exactly the invoice.upcoming will trigger?

bronze pulsar
#

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

bronze pulsar
urban depot
#

so this 3 days at which time? 12 midnight?

bronze pulsar
#

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.

urban depot
#

i see, that make sense

bronze pulsar
#

I recommend that you look at the example event and confirm as well

urban depot
#

yeah sure!

#

thank you for your time, and have a nice day!