From 8bc8b384c5513a741b9036e010f58f682f0e2bd1 Mon Sep 17 00:00:00 2001 From: Joshua Dwire Date: Sat, 14 May 2016 22:38:09 -0400 Subject: [PATCH] Fix auto bill error when the user hasn't entered payment information --- app/Services/PaymentService.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Services/PaymentService.php b/app/Services/PaymentService.php index 11d9cda41e9f..4425adeebaa3 100644 --- a/app/Services/PaymentService.php +++ b/app/Services/PaymentService.php @@ -821,6 +821,11 @@ class PaymentService extends BaseService $invitation = $invoice->invitations->first(); $token = $client->getGatewayToken($accountGateway/* return parameter */, $accountGatewayToken/* return parameter */); + + if (!$accountGatewayToken) { + return false; + } + $defaultPaymentMethod = $accountGatewayToken->default_payment_method; if (!$invitation || !$token || !$defaultPaymentMethod) {