- Calls
prepareFlowSigning, which checks the quote and the wallet balance and moves the flow tosigning. - Switches the wallet to the network the transaction needs.
- Asks the payer to approve a token allowance, when an ERC-20 payment needs one, and then to sign and send the payment transaction.
- Reports the transaction hash with
broadcastFlow, which moves the flow tobroadcasted.
When to call
CallsubmitFlowTransaction when executionState is quoted and the source is a wallet, after the payer confirms the quote. Do not call it for deposit-address or exchange sources, which the payer pays outside your app.
Usage
Parameters
In
deposit mode, pass the same amount and amountCurrency you passed to getFlowQuote. Without them, the new quote after a decline prices the flow’s current amount in USD.
Returns
Promise<Flow>: usually the flow in broadcasted with txHash set.
When the wallet accepted the transaction but did not return its hash in time, submitFlowTransaction skips the report and returns the flow as it is, still in signing. The transaction may still be on its way. Treat any successful return as sent: show the payment as processing and keep reading the flow with getFlow.
Examples
Show the wallet prompt
Handle a declined or interrupted payment
Errors
After any error other than
UserRejectedError or quote_expired, the payment may already be on its way. Do not call submitFlowTransaction again. Call getFlow and show the screen for its state: a flow still in quoted was not sent, and a flow in signing or later is processing. Handle Flow errors explains the retry rules.
React
useSubmitFlowTransaction is a mutation hook. It takes the same parameters, and it writes the returned flow into the useGetFlow cache.
Related
- Build a custom payment UI: the review and confirm screens.
- Handle Flow errors: every error and the retry rules.
prepareFlowSigning: sign and report the transaction yourself.