Catching Stripe Errors With Try/Catch PHP Method
Answer : If you're using the Stripe PHP libraries and they have been namespaced (such as when they're installed via Composer) you can catch all Stripe exceptions with: <?php try { // Use a Stripe PHP library method that may throw an exception.... \Stripe\Customer::create($args); } catch (\Stripe\Error\Base $e) { // Code to do something with the $e exception object when an error occurs echo($e->getMessage()); } catch (Exception $e) { // Catch any other non-Stripe exceptions } I think there is more than these exceptions ( Stripe_InvalidRequestError and Stripe_Error ) to catch. The code below is from Stripe's web site. Probably, these additional exceptions, which you didn't consider, occurs and your code fails sometimes . try { // Use Stripe's bindings... } catch(Stripe_CardError $e) { // Since it's a decline, Stripe_CardError will be caught $body = $e->getJsonBody(); $err = $body['error']; print('Status is:...