Listen for Successful Account Link Messages
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.
Handle failed account links
If the link attempt fails, the iframe emits an accountLinkError message instead. Its info carries the account type, the HTTP status of the failed request (data.info.status, absent when the request never reached the API), and the error message (data.info.message) — so you can surface the reason to the customer or log it for support rather than seeing only a generic failure screen.
If you embed the flow with the React SDK, pass an onAccountLinkError callback to <CoinflowWithdraw> instead of registering your own listener.

