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

oussamaben's avatar

Laravel Cashier Stripe with automatic calculations

so i had my payment livewire componenet working fine, but i wanted to add automatic tax calculation, as the documentation says to add the :

public function boot()
    {
        Cashier::calculateTaxes();
    }

in the AppServiceProvider.

and adding

'tax_behavior' => 'exclusive',
//like this 
$price_id = $stripe->prices->create(
                    [
                        'product' => $product_id->id,
                        'unit_amount' => $pushedOrder->price * 100,
                        'currency' => 'eur',
                        'tax_behavior' => 'exclusive',
                    ]
                );
  $user->tabPrice($price_id->id, 1);

to my prices.

but when i want to invoice the user doingthis :

$stripeInvoice = $user->invoice();

the $stripeInvoice object is empty, when i want to access the invoice id to store it , it says cannot proprety id on bool ? i dont undrestand what m i missing here

0 likes
2 replies
tisuchi's avatar

@oussamaben Can you use try-catch which will provide you with more information?

For example:

try {
    $stripeInvoice = $user->invoice();
    // Your code to store the invoice ID or perform any other necessary actions
} catch (\Exception $e) {
    // Log or handle the exception
    dd($e->getMessage());
}
oussamaben's avatar

@tisuchi yes thats where i got the message :: cannot proprety id on bool because i was saving the id in the Invoice model that i have locally

Please or to participate in this conversation.