#elitan
1 messages ยท Page 1 of 1 (latest)
I'm asking because I would expect an invoice to always have an id.
Ok, then coming back to my first question. Why is id optional for the Invoice interface?
id?: string instead of id: string
K yeah just double checked with a teammate and essentially these types are just somewhat vague โ they are determined from our OpenAPI spec, which comes from internal definitions, and various fields default to being nullable.
Though yeah that's odd that it changed there
I'll file some feedback internally so we can take a closer look at these types and ensure they are accurate
ok, thanks. I'll override with id: string internally for now then. Thank you.
๐
@open crest okay so the actual reason here is because the upcoming invoice endpoint uses the same model and in that case the ID actually is not present (since the invoice hasn't been created yet).
Forgot about that
Hmm, not sure I understand. Is it a future endpoint that will be released?
No sorry, should have linked the endpoint. It is this one: https://stripe.com/docs/api/invoices/upcoming
So if you want to preview a future invoice
You use that endpoint