Documentation Index
Fetch the complete documentation index at: https://docs.dynamic.xyz/docs/llms.txt
Use this file to discover all available pages before exploring further.
submitCheckoutTransaction
Prepares, signs, and broadcasts a checkout transaction in one call. This is the recommended way to complete a checkout — it orchestrates the full submission flow:- Advances to signing state and confirms the quote is still valid.
- Ensures the wallet is on the correct network for the transaction
- Delegates on-chain signing to the wallet provider via
executeSwapTransaction - Notifies the api that the transaction has been broadcasted, with the resulting transaction hash, so the api can begin confirmation/settlement processing.
Usage
Parameters
| Parameter | Type | Description |
|---|---|---|
transactionId | string | The checkout transaction ID returned by createCheckoutTransaction. |
walletAccount | WalletAccount | The connected wallet account to sign the transaction with. |
onStepChange | (step: 'approval' | 'transaction') => void (optional) | Callback invoked when the signing step changes. 'approval' fires when an ERC-20 token allowance approval is needed; 'transaction' fires when the main transaction signing begins. |
Returns
Promise<CheckoutTransaction> - The updated transaction object after broadcast.
Step Lifecycle
| Step | Description |
|---|---|
approval | The wallet is signing a token approval transaction (only for ERC-20 tokens when allowance is insufficient). |
transaction | The wallet is signing the main swap/transfer transaction. |
Examples
Basic submission
With step progress UI
This example uses React; the JavaScript SDK is framework-agnostic and can be used with any frontend or in Node.
Handle user rejection
If the user rejects the signing request in their wallet, the promise rejects with an error containing'rejected':
Related
createCheckoutTransaction- Create a new checkout transactiongetCheckoutTransactionQuote- Get a transaction quotecancelCheckoutTransaction- Cancel a pending transaction