Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

katawura's avatar

Laravel cashier download invoice not working

l have been having a weird issue where laravel cashier's download doesn't work, in my controller l got

public function downloadInvoice($invoiceId)
    {
        $user = Auth::user();
        User::setStripeKey(env('STRIPE_SECRET'));
        return $user->downloadInvoice($invoiceId, [
            'vendor'  => 'Animalgram',
            'product' => 'Monthly Subscription'
        ]);
    }

and in my view l got

<a href="/account/invoices/{{ $invoice->id }}"><div class="pdfDownload btn-back-color" style="border-radius:initial;">
                                                <i class="fa fa-download left"></i>
                                                <p class="left">PDF</p>
                                                <div class="clear"></div>
                                            </div></a>

The button works but on downloading the pdf invoice it comes up with server error. Just to mention l have also got dompdf installed. Any one came across this issue before?

0 likes
1 reply
katawura's avatar
katawura
OP
Best Answer
Level 8

Sorted this by suppressing $dompdf->render(); and it worked.

Please or to participate in this conversation.