The Payment Widget handles crypto network selection and address collection for withdrawals. Your backend creates the session, then continues with the REST API to create a quote and transaction once the user has provided the destination details.Documentation Index
Fetch the complete documentation index at: https://developer.uphold.com/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- The user has completed onboarding and has the required capabilities enabled.
Walkthrough
Select source account
Crypto withdrawals can be sourced from any account. If the selected account is not in the withdrawal asset, the balance will be converted at the time of the transaction using Uphold’s prevailing rate. Make sure the origin asset has the necessary features enabled. Call List accounts to retrieve the user’s accounts and let them choose one with sufficient balance for the withdrawal.Set a crypto destination
The widget lets the user select a crypto network and enter the destination address.Create a payment session
Call the Create payment session endpoint to create a session for theselect-for-withdrawal flow.
session object with a token and url to initialize the widget.
Set up the widget
Initialize the widget for theselect-for-withdrawal flow using the session data returned from the API.
The example above is for web applications. For native apps using a WebView, you’ll need a bridge for events as outlined in Installation & setup.
Handle the complete event
The widget lets the user select a network and enter a destination address. If the network requires a destination tag or memo, the widget prompts for it and warns the user if it’s missing. When the user completes the selection, thecomplete event fires with via: "crypto-network".
via— set tocrypto-networkwhen the user provides a crypto withdrawal address.selection.network— the selected blockchain network (e.g.bitcoin,xrp-ledger).selection.address— the destination wallet address.selection.reference— the destination tag or memo, if required by the network.
Handle cancellations
Thecancel event fires when the user closes the widget without completing the selection.
Handle errors
Theerror event fires when an error occurs during the flow.
Create a quote
Use theselection data from the widget to create a quote via the Create quote endpoint.
Quotes typically expire quickly. Prompt for user confirmation within the expiry window and requote if needed.
Handle quote requirements
When the quote is returned, check therequirements array. If non-empty, resolve each requirement before creating the transaction.
Travel Rule
Travel Rule is a regulatory requirement that mandates the collection and transmission of information about the originator and beneficiary of certain crypto transactions. Use the Travel Rule widget to collect the required information.Create a travel rule session
Call Create session with"flow": "withdrawal-form" and the quote id.
session object with a token and url to initialize the widget.
Set up the widget
Initialize the widget for thewithdrawal-form flow using the session data returned from the API.
The example above is for web applications. For native apps using a WebView, you’ll need a bridge for events as outlined in Installation & setup.
Handle the complete event
Thecomplete event fires when the user successfully submits the Travel Rule form. Send the travelRule data to your backend to include when creating the transaction.
Handle cancellations
Thecancel event fires when the user closes the widget without completing the form.
Handle errors
Theerror event fires when an unrecoverable error occurs.
Create a transaction
Once the user confirms the quote, create the transaction using the Create transaction endpoint. If the Travel Rule widget emitted acomplete event, include the travelRule data in params.
crypto-address node reflecting the recipient’s on-chain address.
Execution modes
Crypto withdrawals support different execution modes depending on the destination and environment:- On-chain execution: The transaction is processed directly on the blockchain network. The
destination.node.execution.modewill beonchainand include blockchain-specific details such as transaction hashes upon completion. - Off-chain execution: When both the sender and recipient are Uphold users, the transaction is processed internally within Uphold’s infrastructure. This eliminates network fees and is faster than onchain processing. The
destination.node.execution.modewill beoffchain. For offchain transactions, theexecutionobject includes additional properties:accountOwnerId(the recipient user ID) andaccountId(the recipient account ID). - Simulated execution: Used in development environments for testing purposes. The transaction appears processed but does not affect actual blockchain state (user balances will be affected though). The
destination.node.execution.modewill besimulated.
Monitor for settlement
Prefer webhooks for real-time updates, or fall back to polling if webhooks are not feasible.- Webhook events (recommended):
- core.transaction.created
status: processing→ initiated but not yet broadcast
- core.transaction.status-changed
status: completed→ broadcast and confirmedstatus: on-hold→ transaction checks paused (e.g., pending RFIs)status: failed→ transaction failed, checkstatusDetailsfor more info
- core.transaction.created
- Polling (fallback): Get transaction
Notify the user
Display an in-app confirmation when the transaction iscompleted, and send an email if applicable.
You now support crypto withdrawals via the Payment Widget.