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 a React component for your purchase form
  • Import the wallet object
  • Create a height state variable
  • Create the handler function
  • Set function on mount
  • Add the Coinflow UI Component
  • Pass in your handleHeightChange function
  • Set up a dynamic height wrapper
Recipes

Add dynamic height to a Coinflow UI component

Was this page helpful?
Previous

Add Dynamic Height to Apple Pay Button

Next
Built with
React
1function PurchaseForm({
2 amount,
3}: {
4 amount: number;
5}) {
6 const wallet = useLocalWallet();
7
8 const [height, setHeight] = useState<number>(0);
9
10 const handleHeight = useCallback((newHeight: string) => {
11 setHeight(Number(newHeight));
12 }, []);
13
14 return (
15
16 <div style={{ height: `${height}px` }} className={`w-full`}>
17 <CoinflowPurchase
18 wallet={wallet}
19 merchantId={"donation-site"}
20 env={"prod"}
21 connection={wallet.connection}
22 onSuccess={() => console.log('Success!')}
23 transaction={'Your transaction object here'}
24 blockchain={"solana"}
25 amount={amount}
26 loaderBackground={"#FFFFFF"}
27 handleHeightChange={handleHeight}
28 chargebackProtectionData={[]}
29 />
30 </div>
31 );
32}
Response Example
1{"success":true}

Add a React component for your purchase form

I’ll call this one

Something went wrong!
. It was be any react component.

Import the wallet object

This will be passed to Coinflow later on

Create a height state variable

You can set this to anything initially. I’m using 0 to start.

Create the handler function

As another state variable, initialize the function that will change the Coinflow UI height.

Set function on mount

Copy this code to set the handleHeightChange function. This will render the Coinflow UI.

Add the Coinflow UI Component

In this case, I’ll use

Something went wrong!
, but you can use any other Coinflow UI component.

Pass in your handleHeightChange function

Add your function to the

Something went wrong!
component

Set up a dynamic height wrapper

Use a style object to configure dynamic height using your state variable height