diff --git a/src/pages/settings/Subscription/CardAuthenticationModal/index.tsx b/src/pages/settings/Subscription/CardAuthenticationModal/index.tsx index 41ed4d667fc4..80cde4cb862c 100644 --- a/src/pages/settings/Subscription/CardAuthenticationModal/index.tsx +++ b/src/pages/settings/Subscription/CardAuthenticationModal/index.tsx @@ -23,6 +23,10 @@ function CardAuthenticationModal({headerTitle}: CardAuthenticationModalProps) { const [privateStripeCustomerID] = useOnyx(ONYXKEYS.NVP_PRIVATE_STRIPE_CUSTOMER_ID); const [isLoading, setIsLoading] = useState(true); + const onModalClose = () => { + PaymentMethods.clearPaymentCard3dsVerification(); + }; + useEffect(() => { if (privateStripeCustomerID?.status !== CONST.STRIPE_GBP_AUTH_STATUSES.SUCCEEDED) { return; @@ -36,6 +40,7 @@ function CardAuthenticationModal({headerTitle}: CardAuthenticationModalProps) { const message = event.data; if (message === CONST.GBP_AUTHENTICATION_COMPLETE) { PaymentMethods.verifySetupIntent(session?.accountID ?? -1, true); + onModalClose(); } }, [session?.accountID], @@ -48,10 +53,6 @@ function CardAuthenticationModal({headerTitle}: CardAuthenticationModalProps) { }; }, [handleGBPAuthentication]); - const onModalClose = () => { - PaymentMethods.clearPaymentCard3dsVerification(); - }; - return (