diff --git a/portal/autopay.php b/portal/autopay.php index d1178d81..9f458574 100644 --- a/portal/autopay.php +++ b/portal/autopay.php @@ -92,14 +92,22 @@ if (!$config_stripe_enable || !$config_stripe_publishable || !$config_stripe_sec customers->retrievePaymentMethod( - $stripe_id, - $stripe_pm, - [] - ); + // Get payment method info (last 4 digits etc) + $payment_method = $stripe->customers->retrievePaymentMethod( + $stripe_id, + $stripe_pm, + [] + ); + + } catch (Exception $e) { + $error = $e->getMessage(); + error_log("Stripe payment error - encountered exception when fetching payment method info for $stripe_pm: $error"); + logApp("Stripe", "error", "Exception when fetching payment method info for $stripe_pm: $error"); + } $card_name = nullable_htmlentities($payment_method->billing_details->name); $card_brand = nullable_htmlentities($payment_method->card->display_brand); diff --git a/portal/index.php b/portal/index.php index a80c9bf9..eef09ea1 100644 --- a/portal/index.php +++ b/portal/index.php @@ -8,7 +8,6 @@ header("Content-Security-Policy: default-src 'self'"); require_once "inc_portal.php"; - ?>