Skip to main content
By the end of this guide, you’ll understand how to use each SDK callback function to respond to key events in the user journey.
Before you start

Overview

When a user interacts with Link, Mesh fires SDK events that you can respond to in your app. The four callback functions below cover the most important moments in the user journey: connecting an account, completing a transfer, exiting, and responding to granular in-flow events.

SDK callback functions

SDK-specific instructions for setting up callback functions

Example: Handle withdrawalRequested in onEvent()

In the Mesh-hosted withdrawal flow, Mesh fires withdrawalRequested when the user confirms a withdrawal, then Link closes. Use onEvent() to trigger any in-app step your withdrawal flow requires (eg. 2FA) and show the user the right screen next. See Add Mesh to your withdrawal flow for the full flow.
Never send funds based on this event. Front-end data can be manipulated by the user, so withdrawalRequested doesn’t carry money movement details. Always take the send-to address, asset, network, and amount from the withdrawal webhook, received and signature-verified on your server.

What’s next

Next up: Supercharge return-users — once you’re capturing accessTokens via onIntegrationConnected, you’re ready to set up Mesh Managed Tokens for a seamless return-user experience.
AI coding reference — a compact summary of this page’s APIs, parameters, and patterns for use by AI coding assistants (following the llms.txt standard). Human readers can safely ignore this.llms.txt — Use Mesh’s callback functionsThe 4 SDK callback functions for responding to key user journey events. Wire all 4 in every SDK initialization.onIntegrationConnected(payload) — fires when user connects an exchange or wallet. Key payload: accessToken.accountTokens[].tokenId (store this for MMT) | accessToken.brokerType | brokerBrandInfo (icons/logos)onTransferFinished(payload) — fires when transfer flow completes. Use for immediate UI updates only; use webhooks for business logic. Key payload: status (pending/succeeded/failed) | userId | transactionId | txId (exchange-specific) | transferId (Mesh-specific) | txHash | symbol | amount | amountInFiat | totalAmountInFiat | fromAddress | toAddress | refundAddress | networkId | networkNameonExit() — fires when user closes Link at any point. Key payload: errorMessage | summary.page | selectedIntegration (name + Id) | transfer.previewIdonEvent(ev) — fires for granular in-flow events. Use for analytics and specific UX logic. See Mesh SDK events guide for full event list.Mesh-hosted withdrawals: in onEvent, check ev.type === 'withdrawalRequested' to trigger 2FA or update UI after the user confirms (Link closes). Payload is { transferId, status } (status: pending | success, pending in practice); no money movement details. Send funds only from the server-side withdrawal webhook.Critical: onTransferFinished fires when the provider acknowledges the request — not when it confirms on-chain. Always use webhooks for final confirmation before crediting users or releasing inventory.Web SDK — canonical initialization with all 4 callbacks:
iOS Swift — all 4 callbacks:
Android Kotlin — callbacks via LaunchLink result:
React Native — all 4 callbacks as JSX props:
Flutter — callbacks via MeshConfiguration: