The Payment Widget handles card selection only. Your backend must create the transaction via the REST API.
Prerequisites
- The user has completed onboarding and has the required capabilities enabled.
- The Payment Widget SDK is installed in your frontend. See Installation and setup.
Walkthrough
Select source account
Card withdrawals can be sourced from any account. If the selected account is not in the card’s currency, 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 pick the one to withdraw from.Link or select a card account
The widget session lets the user link a new card or select an existing one.Create a widget session
Call Create widget session to start theselect-for-withdrawal flow.
response.session to your frontend to initialize the widget.
Set up the widget
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 after the user selects a card. The event payload includes the selected card external account.
Handle cancellations
Handle errors
Theerror event fires for critical unrecoverable errors. Card-specific errors (duplicate card, country mismatch, card limits) are handled by the widget internally.
Create a quote
Call Create quote with the origin account and the selected card external account as destination.Quotes typically expire quickly. Prompt for user confirmation within the expiry window and requote if needed.
Confirm and create transaction
Once the user confirms, call Create transaction with the quote ID.account and the destination is the external-account representing the card. The transaction status is initially processing and updates to completed once the transfer settles.
Monitor for settlement
Card withdrawal transactions may remain inprocessing while the payment settles. Monitor until the transaction reaches a terminal state.
- Webhook events (recommended):
- core.transaction.created —
status: processing→ transaction created, pending settlement - core.transaction.status-changed —
status: completed→ funds settled;status: failed→ irrecoverable error
- 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 card withdrawals via the Payment Widget.