laravel 5 - Hadle cartlyst strip plan error -
i creating payment plan strip using cartalyst strip api in laravel application, working correctly when strip shows error, directly showing in dom. want store in variable , redirect previous page. have used try...catch
method not working create plan.
below code
$stripe = stripe::make(stripe_key); try { $plan = $stripe->plans()->create([ 'id' => 'monthly', 'name' => 'palan name' 'amount' => '22', 'currency' => 'usd', 'interval' => 'month', 'interval_count' => '6', 'statement_descriptor' => 'test description' ]); } catch (stripe\error\base $e) { echo($e->getmessage()); }
i'm not familiar library think issue not catching errors here cartalyst has in own namespace. can see in documentation give examples on how catch errors:
try { $customer = $stripe->customers()->find('foobar'); echo $customer['email']; } catch (cartalyst\stripe\exception\notfoundexception $e) { // status code $code = $e->getcode(); // error message returned stripe $message = $e->getmessage(); // error type returned stripe $type = $e->geterrortype(); }
they don't mention how catch base
1 though , don't have access code double check i'd guess it's oversight , can catch cartalyst\stripe\exception\base $e
Comments
Post a Comment