For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
RegisterLoginSandbox Login
GuidesRecipesAPI Reference
GuidesRecipesAPI Reference
  • Recipes
    • Add 3DS Challenge (Angular)
    • Add Dynamic Height to Coinflow UI Component
    • Add Dynamic Height to Apple Pay Button
    • Add Dynamic Height to Coinflow iframe
    • Add Dynamic Loading to Coinflow iframe
    • Apple Pay Payouts API Implementation
    • Complete Checkout with 3DS Challenge (React)
    • Listen for Purchase Events
    • Listen for Successful Account Link Messages
    • Listen to Client-Side Messages on Swift iOS
    • Listen to Payment Success Messages
    • PCI Compliant Card Tokenization
    • Tokenize Card Data via API for Checkout
    • Tokenize Card Data via API for Debit Card Payouts
    • Tokenize Cards for Saved Card Checkout (Vue)
    • Tokenize Debit Cards for Withdraws
    • Upload files to Coinflow storage
LogoLogo
RegisterLoginSandbox Login
On this page
  • Add Dynamnic Height Handler to
Recipes

Add dynamic height to Coinflow iframe

Was this page helpful?
Previous

Add Dynamic Loading to Coinflow iframe<>

Next
Built with
Dynamic Heigh
1const [height, setHeight] = useState<string>('500');
2
3const handleIframeMessages = useCallback(
4 ({data, origin}: {data: string; origin: string}) => {
5 if (!origin.includes('coinflow.cash')) return;
6
7 try {
8 const message = JSON.parse(data);
9 if (message.method !== 'heightChange') return;
10 setHeight(message.data);
11 } catch (e) {}
12 },
13 []
14);
15
16useEffect(() => {
17 if (!window) throw new Error('Window not defined');
18 window.addEventListener('message', handleIframeMessages);
19 return () => {
20 window.removeEventListener('message', handleIframeMessages);
21 };
22}, [handleIframeMessages]);
23
24<div style={{height: `${height}px`}}>
25 <iframe
26 allow={'payment; geolocation'}
27 scrolling="no"
28 style={{height: '100%', width: '100%'}}
29 src={'https://sandbox.coinflow.cash/...' +'&useHeightChange=true'}
30 />
31</div>
Response Example
1{"success":true}

Add Dynamnic Height Handler to

This snippet will allow you to capture and utilize dynamic height when utilizing coinflow checkout links embedded in an iframe on your site.