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

clickweb's avatar

Laravel Cashier Stripe apply taxes depends on user location

I have setup cashier and subscription but having issue to charge user taxes depends of their state location. For example if user enter billing address from Ontario, Canada he will be charge one tax, if user enter Alberta, Canada another tax will apply. I have enter this code in User model to apply taxes but its not working

public function taxRates() { $stripe = new StripeClient(env('STRIPE_SECRET')); $taxRates = []; $taxes = $stripe->taxRates->all(); foreach ($taxes->data as $tax){ if(($tax->jurisdiction == $this->state) && ($tax->active == true)){ $taxRates[] = $tax->id; } } return $taxRates; }

0 likes
0 replies

Please or to participate in this conversation.