Check if it is returning something
$billable = Cashier::findBillable($company->user_id);
dd($billable);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello everyone!
I have this route
Route::get('/stripe/download/invoice/{company_id}/{invoice_id}', [AdminController::class, 'downloadStripeInvoice']);
which should download a specific invoice. Here's the controller code:
use Laravel\Cashier\Cashier;
public function downloadStripeInvoice($company_id, $invoice_id) {
$company = Companies::where('id', $company_id)->first();
$billable = Cashier::findBillable($company->user_id);
return $billable->downloadInvoice($invoice_id, [], "invoice_" . $invoice_id);
}
But I'm getting an error Call to a member function downloadInvoice() on null. I dumped $company->user_id and it shows correct user_id for the company_id from the parameter. Any ideas why it isn't working?
@crypt.001111101 and the user_id stored in company. Is it regular id or stripe_id ?
Please or to participate in this conversation.