Billing request return url redirect not working

Getting this screen after return url of billing.request completes successfully. Not properly redirecting to app home page from where billing approval started

doing it like this fixed the issue:

    return json({ redirectTo: ROUTES.HOME });
  } catch (error) {
    if (error instanceof Response) {
      throw error;
    }
    console.error('Error in billing confirmation loader:', error);
    return json({ redirectTo: `${ROUTES.HOME}?${URL_SEARCH_PARAMS.BILLING.BILLING_ERROR}=true` });
  }
};

export default function BillingConfirm(): null {
  const { redirectTo } = useLoaderData<typeof loader>();
  const navigate = useNavigate();

  useEffect(() => {
    navigate(redirectTo, { replace: true });
  }, [navigate, redirectTo]);

  return null;
}

1 Like

Thanks for sharing the fix, @Jaspreet_Singh