#Gregg - upcoming invoices

1 messages · Page 1 of 1 (latest)

robust quiver
#

Hi 👋
Do you have any event IDs I could review?

gritty carbon
#

@robust quiver sure here you go evt_1KLy66CiGnwRdCOXHDOF1CLt

robust quiver
#

Thanks. I'll take a look now

#

Okay so this event is for a subscription update. This means the object I can see is the subscription. I thought your problem was that you couldn't find the subscription an invoice.upcoming event? Or am I mistaken?

gritty carbon
#

@robust quiver You are correct but I don't see that event after I changed the status of the subscription. I see the preview of that upcoming invoice in the UI though. I don't see the subscription in Sigma but maybe it has a delay?

robust quiver
#

Ah so this is a view through Sigma? My apologies, I didn't ask for clarity on where you were accessing this information.

gritty carbon
#

@robust quiver Sorry that's where I'm starting from to figure out the structure. This is specifically the IDs: /cus_JJD7QKFh9gEyfY/upcoming_invoice/sub_1KLvyzCiGnwRdCOXrf3pObAW

robust quiver
#

You can see the basic charges for the upcoming invoice.

gritty carbon
#

So I should query Payments instead of Subscriptions?

#

actually that doesn't look right. I don't see why I can't bring up the subscription when querying "subscriptions" in sigma.

#

The UI you showed me looks good but I'm stuck with in the "tables" or api to get the upcoming invoices

robust quiver
#

Okay so you want to have the subscription associated with an upcoming invoice be returned in a query in Sigma?

gritty carbon
#

Right

#

Basically all upcoming invoices tied to subscriptions

robust quiver
#

What's the query you are using?

gritty carbon
#

I can't even find the subscription like so:

select *
from subscriptions where id = 'sub_1KLvyzCiGnwRdCOXrf3pObAW'

robust quiver
#

I tend to think about this from the standpoint of the APIs (since this is a channel for developers). With respect to upcoming invoices, they are not stored on a subscription. The actual invoice isn't created until the renewal date.

gritty carbon
#

No problem, I can focus on API first. If you were to pull a list of upcoming invoices, how would you go about that?

#

I checked the logs and don't see any events for the upcoming invoice api which I think the dashboard updates would have set, no?

robust quiver
gritty carbon
#

When a subscription is created and invoice sent through dashboard, should there be an event created automatically since the preview in the dashboard shows the upcoming invoice?

robust quiver
#

When you create the subscription and send the invoice through the dashboard it will not trigger the upcoming invoice event.

gritty carbon
#

gotcha

robust quiver
#

The intent behind this event is to operate as a reminder to your application of automatic billing coming up. We assume if you did it manually, you don't need the reminder

gritty carbon
#

ok I see. Can you point me in the right direction get some questions answered about sigma queries?

robust quiver
gritty carbon
#

Yeah I've been getting deep with queries but I don't understand why the subscription is not returning. I wonder if there's a delay or some caching.

robust quiver
#

You can't query them that way since the actual invoice does not exist. That's why the API for requesting the upcoming invoice requires a subscription or customer ID. It's dynamically created when you make the request.

gritty carbon
#

OK so we'd have to loop through all active subscriptions and retrieve upcoming one by one to build that data set

robust quiver
#

In that case yes. Or you can do it by customer if that's easier.

gritty carbon
#

ok thank you for your time!