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.
The complete event fires after the user selects a card. The event payload includes the selected card external account.
widget.on('complete', (event) => { const { via, selection } = event.detail.value; if (via === 'external-account') { // selection is the selected card external account // use selection.id as the destination in the quote handleCardSelected(selection); } widget.unmount();});
Once you have the selected card, prompt the user to select a source account, then create a quote.
The error event fires for critical unrecoverable errors. Card-specific errors (duplicate card, country mismatch, card limits) are handled by the widget internally.
widget.on('error', (event) => { console.error('Widget error:', event.detail.error); widget.unmount(); // Show a user-friendly error message});
The Payment Widget handles most errors internally. For unrecoverable errors, the widget fires an error event. It is the host application’s responsibility to handle these events, present an error message to the user, and unmount the widget.
POST /core/transactions{ "quoteId": "a91f3c72-1e4b-4c8a-b3e9-9f2d8e4b7c1a"}
In a successful card withdrawal, the origin is the user’s 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.