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

Swaz's avatar
Level 20

What are pending invoices on Stripe/Cashier?

Laravel Cashier has these methods to retrieve invoices from Stripe:

https://laravel.com/docs/6.x/billing#invoices

$invoices = $user->invoices();
$invoices = $user->invoicesIncludingPending();

My app has a monthly subscription. Under what conditions would I end up with a pending invoice?

0 likes
1 reply
Nakov's avatar

Looking at the source code:

/**
 * Get a collection of the entity's invoices.
 *
 * @param  bool  $includePending
 * @param  array  $parameters
 * @return \Illuminate\Support\Collection
 */
public function invoices($includePending = false, $parameters = [])
{
    $this->assertCustomerExists();
    $invoices = [];
    $parameters = array_merge(['limit' => 24], $parameters);
    $stripeInvoices = StripeInvoice::all(
        ['customer' => $this->stripe_id] + $parameters,
        $this->stripeOptions()
    );
    // Here we will loop through the Stripe invoices and create our own custom Invoice
    // instances that have more helper methods and are generally more convenient to
    // work with than the plain Stripe objects are. Then, we'll return the array.
    if (! is_null($stripeInvoices)) {
        foreach ($stripeInvoices->data as $invoice) {
            if ($invoice->paid || $includePending) {
                $invoices[] = new Invoice($this, $invoice);
            }
        }
    }
    return new Collection($invoices);
}

/**
 * Get an array of the entity's invoices.
 *
 * @param  array  $parameters
 * @return \Illuminate\Support\Collection
 */
public function invoicesIncludingPending(array $parameters = [])
{
    return $this->invoices(true, $parameters);
}

A pending invoice is an upcoming invoice, an invoice that hasn't been paid yet. It can also be found in the Stripe docs, read the Previewing upcoming invoices section.

Please or to participate in this conversation.