diff --git a/src/CONST/index.ts b/src/CONST/index.ts index ac194f55a87a..8386eaf671d0 100755 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -6980,6 +6980,7 @@ const CONST = { BILLING: { TYPE_FAILED_2018: 'failed_2018', + TYPE_STRIPE_FAILED_AUTHENTICATION: 'failed_stripe_authentication', }, ONBOARDING_HELP: { diff --git a/src/pages/settings/Subscription/CardSection/CardSection.tsx b/src/pages/settings/Subscription/CardSection/CardSection.tsx index 20762eed2ec5..f61b30fb9d05 100644 --- a/src/pages/settings/Subscription/CardSection/CardSection.tsx +++ b/src/pages/settings/Subscription/CardSection/CardSection.tsx @@ -59,6 +59,10 @@ function CardSection() { const {isOffline} = useNetwork(); const defaultCard = useMemo(() => Object.values(fundList ?? {}).find((card) => card.accountData?.additionalData?.isBillingCard), [fundList]); const cardMonth = useMemo(() => DateUtils.getMonthNames()[(defaultCard?.accountData?.cardMonth ?? 1) - 1], [defaultCard?.accountData?.cardMonth]); + const hasFailedLastBilling = useMemo( + () => purchaseList?.[0]?.message.billingType === CONST.BILLING.TYPE_STRIPE_FAILED_AUTHENTICATION || purchaseList?.[0]?.message.billingType === CONST.BILLING.TYPE_FAILED_2018, + [purchaseList], + ); const requestRefund = useCallback(() => { requestRefundByUser(); @@ -102,11 +106,11 @@ function CardSection() { }; useEffect(() => { - if (!authenticationLink || privateStripeCustomerID?.status !== CONST.STRIPE_SCA_AUTH_STATUSES.CARD_AUTHENTICATION_REQUIRED) { + if (!authenticationLink || (privateStripeCustomerID?.status !== CONST.STRIPE_SCA_AUTH_STATUSES.CARD_AUTHENTICATION_REQUIRED && !hasFailedLastBilling)) { return; } Navigation.navigate(ROUTES.SETTINGS_SUBSCRIPTION_ADD_PAYMENT_CARD); - }, [authenticationLink, privateStripeCustomerID?.status]); + }, [authenticationLink, privateStripeCustomerID?.status, hasFailedLastBilling]); const handleAuthenticatePayment = () => { verifySetupIntent(session?.accountID ?? CONST.DEFAULT_NUMBER_ID, false);