getFlow needs no session token, so it works on any device that has the flow ID.
Usage
Parameters
Returns
Promise<Flow>: the flow as the payer can see it. When the flow has ended, getFlow also removes the flow’s session token from the device, because the server no longer accepts it.
These are the fields a payment UI uses most:
The payer’s view redacts your destination addresses and omits
settlementTxHash. Your server can read both, as described in Access and data.
Execution states
source_confirmed does not mean the payment is done. Keep reading the flow until settlementState is completed or failed. Payment lifecycle and states describes what moves a flow between states.
Settlement data
settlement is written when the settlement completes. It describes what reached your destination:
In
deposit mode, a short deposit settles for what arrived, so settlement.amount can be smaller than the quoted amount. Use getFlowDeliveredAmount to read the delivered amount with its token info.
Examples
Follow a payment until it stops changing
shouldPollFlow returns true while the flow can still change without any action from your page.
Restore a flow on page load
Errors
Handle Flow errors describes every Flow error.
React
useGetFlow reads the flow and refetches it every 3 seconds while shouldPollFlow is true, then stops. Do not pass your own refetchInterval. The hook keeps the newest flow it has seen, and does not retry errors that cannot succeed, such as FlowNotFoundError.
flowId is defined. To run code when a state changes, use useSubscribeToFlowStateChange from the React hooks catalog.
Related
- Build a custom payment UI: route the payment page by the flow’s state.
shouldPollFlow: decide when to read the flow again.getFlowDeliveredAmount: read what a settled flow delivered.