I am using stripe payment gateway in my project. I am trying to display exception errors when a user entered expired card number. but instead of showing me error of exception it shows me laravel error. Note: it is not working with any kind of exception not only expired card number.
You are not catching the Stripe\Exception\CardException exception. You are probably not actually catching Exception either unless you have aliased Exception at the top of your file.
Add use Exception; before the class declaration at the top or adjust Exception in the catch to \Exception.
Looks like the newer version of stripe-php library throws Exceptions from Stripe\Exception and no longer has a namespace Stripe\Error FYI.