diff --git a/app/PaymentDrivers/Braintree/PayPal.php b/app/PaymentDrivers/Braintree/PayPal.php index 6d24013e7c..76b630d00f 100644 --- a/app/PaymentDrivers/Braintree/PayPal.php +++ b/app/PaymentDrivers/Braintree/PayPal.php @@ -111,7 +111,10 @@ class PayPal 'paymentMethodNonce' => $gateway_response->nonce, ]); - return $payment_method->paymentMethod->token; + if($payment_method->success) + return $payment_method->paymentMethod->token; + else + throw new PaymentFailed(property_exists($payment_method, 'message') ? $payment_method->message : 'Undefined error storing payment token.', 0); } /** diff --git a/resources/views/portal/ninja2020/payment_methods/show.blade.php b/resources/views/portal/ninja2020/payment_methods/show.blade.php index f928bfbd53..dbba4777fc 100644 --- a/resources/views/portal/ninja2020/payment_methods/show.blade.php +++ b/resources/views/portal/ninja2020/payment_methods/show.blade.php @@ -31,7 +31,7 @@ {{ ctrans('texts.type') }}
- {{ $payment_method->meta?->brand }} + {{ property_exists($payment_method->meta, 'brand') ? $payment_method->meta?->brand : ''}} {{ property_exists($payment_method->meta, 'scheme') ? $payment_method->meta?->scheme : '' }}