Skip to main content
Flow is an enterprise feature. Contact us to enable it for your environment.

Prerequisites

Before this page: a connected wallet (see Connecting external wallets) for the wallet payment path. Your backend creates the flow and passes its flowId to the frontend — flow creation is server-side; this page covers the frontend.

What you’ll build

A Flow deposit takes a payment from a user’s wallet or an exchange and settles it to a destination. The frontend walks the flow through its lifecycle:
  1. Load the flow and check it’s still actionable.
  2. Attach a source — a wallet or an exchange.
  3. Quote — lock in amounts and fees.
  4. Sign & submit (wallet) or confirm (exchange).
  5. Track to settlement.
The flow’s executionState and settlementState are string unions you branch on at every step.

Load the flow

Read flowId (typically from the URL so a user can resume) and load it with getFlow. Skip the UI when the flow has already reached a terminal state.

Attach a payment source

attachFlowSource records where the payment comes from. For a wallet, pass the user’s address and chain. For an exchange, pass the provider — the response’s flow carries the hosted buy URL to open.

Quote the flow

getFlowQuote returns the flow with a quotefromAmount, toAmount, fees, and estimatedTimeSec. Quotes expire (quote.expiresAt), so let the user re-quote before signing. Omit fromTokenAddress to pay in the chain’s native token.

Sign and submit (wallet)

submitFlowTransaction runs the whole signing pipeline — prepare, approve (if the token needs an allowance), sign, and broadcast. onStepChange fires 'approval' then 'transaction' so you can show progress.
For an exchange source, the user pays on the exchange instead of signing. Once they’re done, call broadcastFlow({ flowId }) to tell the backend the transfer was made.

Track to settlement

Poll getFlow until it settles. executionState covers the on-chain leg (broadcastedsource_confirmed); settlementState covers delivery (settlingcompleted). Stop when either terminates.

Cancelling

Before broadcast, a user can back out with cancelFlow({ flowId }). After broadcast the transaction is on-chain and can’t be reversed — hide the cancel entry point once executionState reaches broadcasted.

Handling errors

See also

Last modified on July 22, 2026