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
  • Install Coinflow Package
  • Handle Height Changes
  • Render CoinflowApplePayButton
Recipes

Add Dynamic Height to Apple Pay Button

Was this page helpful?
Previous

Add dynamic height to Coinflow iframe

Next
Built with
JavaScript
1import {CoinflowApplePayButton} from '@coinflowlabs/react';
2
3
4function App() {
5 const [height, setHeight] = useState<number>(0);
6
7 const handleHeight = useCallback((newHeight: string) => {
8 setHeight(Number(newHeight));
9 }, []);
10
11 return (
12 <div style={{height: `${height}px`}} className="w-full">
13 <CoinflowApplePayButton
14 env={'sandbox | prod'}
15 wallet={wallet}
16 blockchain={'solana | eth | base | polygon | arbitrum'}
17 merchantId={'myMerchantId'}
18 handleHeightChange={handleHeight}
19 amount={amount}
20 color={'black'} // Backgroung color of apple pay button
21 />
22 </div>
23 );
24}
25
26export default App;
Response Example
1{"success":true}

Install Coinflow Package

Run npm i @coinflowlabs/react and import the CoinflowApplePayButton component.

Handle Height Changes

Initialize the height state and create a handler to dynamically update the height of the button when the size changes.

Render CoinflowApplePayButton

Pass the required props such as wallet, blockchain, merchantId, and amount. The button will dynamically adjust its height with the handleHeightChange function.