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

lat4732's avatar
Level 12

Getting only the unpaid invoices from Stripe Laravel Cashier

Hello everyone!

I'm trying to show to the user the unpaid invoices he have and pay them in order to regain access to the website. But there is no function to display only the unpaid invoices in Laravel Cashier's documentation. How can I list only the unpaid invoices?

0 likes
2 replies
Tippin's avatar

@crypt.001111101 I think unpaid invoices are considered open|pending though the default options will still grab all invoices (limiting to 24).

$user->invoicesIncludingPending();

https://github.com/laravel/cashier-stripe/blob/13.x/src/Concerns/ManagesInvoices.php#L278

Perhaps you can then iterate over that collection and filter the invoices that are Open

use Laravel\Cashier\Invoice;

$open = $user->invoicesIncludingPending()
    ->filter(fn (Invoice $invoice) => $invoice->isOpen());

The only other idea I may have would be to see if the parameters you can pass can filter for only Open invoices (have never tried this)

$open = $user->invoicesIncludingPending([
    'status' => 'open',
]);
1 like
lat4732's avatar
Level 12

@Tippin I've actually tried something and I can't say it worked but it's displaying something.

$stripe = new \Stripe\StripeClient(env('STRIPE_SECRET'));
$StripeInvoices = $stripe->invoices->upcoming([
    'customer' => Auth::user()->stripe_id
]);

https://stripe.com/docs/api/invoices/upcoming

I can't say this is the correct way of doing this but I'm still searching. What you are suggesting sounds unlikely to happen but I'll give it a try.

Please or to participate in this conversation.