Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a helper method to download the PDF of an invoice #1229

Open
dunglas opened this issue Dec 28, 2021 · 1 comment
Open

Provide a helper method to download the PDF of an invoice #1229

dunglas opened this issue Dec 28, 2021 · 1 comment

Comments

@dunglas
Copy link

dunglas commented Dec 28, 2021

A helper method is provided to download the PDF of a quote ($quote->pdf()), but not for an invoice.
Unfortunately, doing file_get_contents($invoice->invoice_pdf) to download the PDF doesn't work anymore because PHP doesn't handle the redirection to S3 properly.

Using curl is a working workaround (see dunglas/stripe-invoice-exporter#1), but a dedicated helper method could be convenient.

Best regards,

@richardm-stripe
Copy link
Contributor

Sorry for the late response. Thank you for the suggestion. I'm convinced this would be useful to add. Quote PDF is a special case because the API contains /v1/quotes/:quote/pdf which contains the PDF, but /v1/invoices/:invoice/pdf does not exist (yet?) so the implementation would have to be different. I'm imagining something like
\Stripe\Util::download_file($invoice_pdf) which would be provided for convenience but would just use curl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants