#ajay bhalke-Terminal
1 messages · Page 1 of 1 (latest)
I use try catch block
but unable to handle it
how did you handle it? Did you catch a general type of Exception class?
code looks like below
try {
$terminal = $stripe->terminal->readers->create([
'registration_code' => $request->post('registration_code'),
'label' => $request->post('name'),
'location' => $location->id,
]);
dd(1);
if($terminal) {
if($terminal->error) {
dd('asd');
}
else {
$data['location'] = $location->id;
$flag=1;
}
}
} catch (Exception $e) {
dd($e->getMessage());
}
it does not even goto dd(1)
found solution
try {
// Use Stripe's library to make requests...
} catch(\Stripe\Exception\CardException $e) {
// Since it's a decline, \Stripe\Exception\CardException will be caught
echo 'Status is:' . $e->getHttpStatus() . '\n';
echo 'Type is:' . $e->getError()->type . '\n';
echo 'Code is:' . $e->getError()->code . '\n';
// param is '' in this case
echo 'Param is:' . $e->getError()->param . '\n';
echo 'Message is:' . $e->getError()->message . '\n';
} catch (\Stripe\Exception\RateLimitException $e) {
// Too many requests made to the API too quickly
} catch (\Stripe\Exception\InvalidRequestException $e) {
// Invalid parameters were supplied to Stripe's API
} catch (\Stripe\Exception\AuthenticationException $e) {
// Authentication with Stripe's API failed
// (maybe you changed API keys recently)
} catch (\Stripe\Exception\ApiConnectionException $e) {
// Network communication with Stripe failed
} catch (\Stripe\Exception\ApiErrorException $e) {
// Display a very generic error to the user, and maybe send
// yourself an email
} catch (Exception $e) {
// Something else happened, completely unrelated to Stripe
}
Sorry, just stepping in to take over from @twilit jolt
Looks like you're all set now?
yes
thank you for all help
one more question
I have setup my WisePOS E with stripe
But now I want setup M2?
for WisePOS E code is
$terminal = $stripe->terminal->readers->create([
'registration_code' => 'vivid-ocelot-wombat',
'label' => 'My test device',
'location' => 'tml_xxx',
]);
but for M2 where I can find registration_code?
is the process of register M2 same?
That's a Bluetooth reader, so it's different: https://stripe.com/docs/terminal/fleet/locations#register-bluetooth-readers
thank you so much
Sure, np!