Build a Monthly Subscription App with Laravel Cashier: Lesson 34 of 36


Up Next

Deleting Subscription

Autoplaying in 7 seconds!


To download invoices, Laravel will automatically bring in dompdf in order to create the invoices. If you are getting errors that the package is not installed, be sure to install it using composer from the command line:

composer require dompdf/dompdf

After that, you'll need a route:

// download pdf
Route::get('account/invoices/{invoice}', 'AccountController@downloadInvoice');

Also, the controller code to download the PDF:

Table of Contents

    public function downloadInvoice($invoiceId)
        return Auth::user()->downloadInvoice($invoiceId, [
            'vendor'  => 'Animalgram',
            'product' => 'Monthly Subscription'

    Then a link to that route:

    <a href="/account/invoices/{{ $invoice->id }}">Download</a>

    Chris Sevilleja

    173 posts

    Founder of Google Developer Expert in Web Technologies. Slapping the keyboard until something good happens.