We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am using nextjs, dynamically loading the banner component with ssr set to false, not able to get the notification banner component to work
'use client' import { env } from '@/env.mjs'; import { cn } from '@/lib/utils'; import { StripeConnectInstance, loadConnectAndInitialize } from "@stripe/connect-js/pure"; import { ConnectNotificationBanner, ConnectComponentsProvider, } from '@stripe/react-connect-js'; import { useEffect, useState } from 'react'; export default function StripeNotificationBanner({ className }: { className?: string }) { const [isClient, setIsClient] = useState(false) const [stripeConnectInstance, setStripeConnectInstance] = useState<StripeConnectInstance | null>(null); useEffect(() => { setIsClient(true) }, []) useEffect(() => { if (isClient) { const loadStripeConnect = async () => { const fetchClientSecret = async () => { const response = await fetch('/api/v1/stripe/company_account_session', { method: 'POST', }); if (!response.ok) { const { error } = await response.json(); console.log('An error occurred: ', error); return undefined; } else { const { client_secret: clientSecret } = await response.json(); return clientSecret; } }; const instance = await loadConnectAndInitialize({ publishableKey: env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY, fetchClientSecret, }); setStripeConnectInstance(instance); }; loadStripeConnect(); } }, [isClient]); if (!isClient || !stripeConnectInstance) { return null; } return ( <ConnectComponentsProvider connectInstance={stripeConnectInstance}> <ConnectNotificationBanner // Optional: // collectionOptions={{ // fields: 'eventually_due', // futureRequirements: 'include', // }} /> </ConnectComponentsProvider>) }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I am using nextjs, dynamically loading the banner component with ssr set to false, not able to get the notification banner component to work
The text was updated successfully, but these errors were encountered: