#jarrett - invoice expiration
1 messages · Page 1 of 1 (latest)
@rocky parcel yes we have
@steel remnant I got it as we agreed
@rocky parcel we expire URLs after a while and then there's a recovery flow for the end customer if they need to get access
Ugh, this makes things complicated for us. we store the URL. Probably should document this in the API that the URLs expire.
thanks
ah yeah good point, I'll flag to the product team to improve this
is this only changed on Invoices btw? or is this an across the board thing?
It applies to other customer facing URLs like receipts and such and it will slowly apply to all of those for security reasons
Not sure what that means, but if you retrieve the Invoice you get a fresh URL that works
We store the invoices and copies of all Stripe objects we use and keep them in sync with webhooks so we can make in application decisions without making API calls on various pages. Now this object will never be able to work that way any more because the URL will be junk after a few hours.
it's not junk after a few hours though
And the only way to refresh it is to resync the whole object
how long does it last?
the URL expires after 30 days I think and it refreshes every single time you retrieve the Invoice
But yes after 30d the URL is expired, but it still works. It doesn't just say "too bad, no URL there"
there is no way for us to know if the URL will be good or bad until a user clicks it
it explicitly says "this URL expired but you can recover it by doing X" which is usually entering your email address or similar
Do you have the invoice id for that one?
in_1KP2QIF6KG2nMs1l9LzqYAh6
Thanks! Let me check internally,I thought it was supposed to ask the customer for their email address
thanks
Okay sorry for the delay! I discussed this with the product and for now this is "by design". The "recovery flow" only works if the customer already received that invoice over email as documented here https://support.stripe.com/questions/invoice-link-expiration
It doesn't apply for charge_automatically invoices yet. I mentioned that we have the email from the customer internally so we could trust that and have them recover the link themselves which the team will investigate but it might take a while
For now, you might want to change your flow to not trust the cached URL and simply call the https://stripe.com/docs/api/invoices/retrieve and get a "fresh url" before redirecting them. A bit more work but that gives you a working URL