#rccausey-oldinvoice-pdf

1 messages · Page 1 of 1 (latest)

split quarryBOT
sage temple
#

Hi 👋

What exactly are you trying to get at here?

violet jay
#

whether the URL in the invoice_pdf field is valid indefinitely or is only valid for a certain period of time after invoice finalization.

sage temple
#

That question by itself does not make any sense. What are you trying to achieve?

violet jay
#

it does if I'm planning to store that URL to retrieve the invoice PDF at a later date?

sage temple
#

Ah, so that is what you want to do (retrieve the invoice PDF at a later date).

violet jay
#

yeah, so knowing whether the URL is going to be valid later is important.

#

or if there's a period of time after which it will no longer be valid.

sage temple
#

I think they should remain valid as long as the Invoice object exists on your account. For example, I just pulled down an Invoice PDF from October 2022

violet jay
#

using the API or the dashboard? I'm wondering if fetching the object from the API returns a refreshed PDF URL.

#

but let me see if I have a really old one....

sage temple
#

From the API. Since this server is focused on coding interactions with the APIs, that will be where our advice is focused.

violet jay
#

alright cool, so I guess it's only the hosted page link that expires

sage temple
#

So in that case I am not certain the "Pay online" link in the PDF would still work. My old PDF is paid so I get taken to a page that shows me a reeceipt.

violet jay
sage temple
#

Right, that's what I expected. So you would use the PDFs either just for record keeping or accepting payment outside of Stripe

violet jay
#

it also has this note, so retrieving the object from the API to get the URL might make a new URL. 🤷

Even after expiration, any URLs that the Dashboard displays or a user retrieves through the API are guaranteed to be valid for at least 10 days.

sage temple
#

Okay I just downloaded an Invoice PDF from April 2022 and the "pay online" link worked for me.

#

However, I have a sneaking suspicion that it is a new URL and that, if you downloaded the PDF and held onto it for a year, the link itself might not work.

violet jay
#

I think I found the docs hidden in an API tab that answer my question:

While expired URLs normally redirect (302) to a recovery page, PDF download URLs are an exception. If Stripe detects that a non-browser client (for example, cURL) has requested PDF download URLs, we return a 400 error with a URL expired body response. This allows integrations to more easily detect when an invoice URL has expired, and to retrieve a new working URL by re-requesting the invoice or credit note resource.

#

this seems to indicate that the invoice_pdf URL will expire, and one would have to re-request the Invoice object from the API to get a refreshed URL.

sage temple
#

Yes that makes sense to me. So in that case you would want to store the Invoice ID and retrieve a new copy of the Invoice object if you need the PDF.