laravel / cashier-stripe

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.
https://laravel.com/docs/billing
MIT License
2.37k stars 671 forks source link

invoiceItems() returning null while generating Invoice pdf. #955

Closed rambo666 closed 4 years ago

rambo666 commented 4 years ago

Description:

I tried to produce an invoice pdf using your code as below.

return $user->downloadInvoice($invoice_id, [ 'vendor' => 'Company Name', 'product' => 'Monthly Subscription or Something', ]);

Then I did dd($invoice->invoiceItems()); on pdf view

It returns null.

I tried to do a foreach of $invoice->invoiceItems() and there are no data.

I guess it is conflicting with multiplan subscription Really not sure If I am doing it right or this is a bug.

driesvints commented 4 years ago

invoiceItems is only for extra line items that were applied to an invoice.

$invoice->subscriptions() is for the subscriptions themselves. Is that what you need?

https://github.com/laravel/cashier/blob/11.x/resources/views/receipt.blade.php#L154-L181

rambo666 commented 4 years ago

I think so. Not sure what invoiceItems() really does.

driesvints commented 4 years ago

It's when you add extra items to the invoice. Like with the tab method.

rambo666 commented 4 years ago

Ahh ok yes I got it. Thanks.