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
  • Define the handleMessage function
Recipes

Listen for Successful Account Link Messages

Was this page helpful?
Previous

Listen to Client Side Messages on Swift (iOS)

Next
Built with
JavaScript
1import React, { useEffect } from 'react';
2
3function App() {
4 useEffect(() => {
5 const handleMessage = (event) => {
6
7 try {
8 const data = typeof event.data === 'string' ? JSON.parse(event.data) : event.data;
9
10 if (data?.data === 'accountLinked') {
11 console.log('Successfully linked:', data.info.type); // the type of account linked: bank, card, iban, pix
12 }
13 } catch (error) {
14 console.error('Error:', error);
15 }
16 };
17
18 window.addEventListener('message', handleMessage);
19 return () => {
20 window.removeEventListener('message', handleMessage);
21 };
22 }, []);
23
24 return (
25 <div className="App" style={{ height: "500px" }}>
26 <iframe
27 allow="geolocation"
28 src="https://sandbox.coinflow.cash/solana/withdraw/YOUR_MERCHANT_ID?sessionKey=USER_SESSION_KEY&bankAccountLinkRedirect=URL_ENCODED_URL_TO_REDIRECT_TO"
29 height={"600px"}
30 />
31 </div>
32 );
33}
34
35export default App;
Response Example
1{"success":true}

Define the handleMessage function

handleMessage function parses the data and converts it to a json object. Then, if the message contains ‘accountLinked’, it logs a success message along with the account type (data.info.type) — which could be “bank”, “card”, “iban”, or “pix”.

Merchants can replace this with their own functionalities here.