#Gregg - upcoming invoices
1 messages · Page 1 of 1 (latest)
@robust quiver sure here you go evt_1KLy66CiGnwRdCOXHDOF1CLt
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?
@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?
Ah so this is a view through Sigma? My apologies, I didn't ask for clarity on where you were accessing this information.
@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
Yeah I find the Payment views more informative. For this subscription I find looking here more useful: https://dashboard.stripe.com/subscriptions/sub_1KLvyzCiGnwRdCOXrf3pObAW
You can see the basic charges for the upcoming invoice.
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
Okay so you want to have the subscription associated with an upcoming invoice be returned in a query in Sigma?
What's the query you are using?
I can't even find the subscription like so:
select *
from subscriptions where id = 'sub_1KLvyzCiGnwRdCOXrf3pObAW'
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.
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?
If you know the customer or the subscription ID, you can query the API for the upcoming invoice:
https://stripe.com/docs/api/invoices/upcoming
When I check the logs for your account I only see the invoice.upcoming event firing in live mode and the most recent is 1 year old.
https://dashboard.stripe.com/events/evt_1IBc7ECiGnwRdCOXzAissso8
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?
I mean I can see the upcoming invoice here https://dashboard.stripe.com/customers/cus_JJD7QKFh9gEyfY/upcoming_invoice/sub_1KLvyzCiGnwRdCOXrf3pObAW but there's no associated upcoming invoice event logged?
When you create the subscription and send the invoice through the dashboard it will not trigger the upcoming invoice event.
gotcha
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
ok I see. Can you point me in the right direction get some questions answered about sigma queries?
I would start with this page if you haven't seen it yet.: https://stripe.com/docs/sigma/writing-queries
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.
One more api related question for now. How can I see all upcoming invoices from the api? I wasn't able to see what params would be sent to https://stripe.com/docs/api/invoices/list
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.
OK so we'd have to loop through all active subscriptions and retrieve upcoming one by one to build that data set
In that case yes. Or you can do it by customer if that's easier.
ok thank you for your time!