Prerequisites
- The user has completed onboarding.
- Capabilities — card buys require the
cardscapability, and APM buys requiredepositsand the capability of the method, such aspaypal. Converting fiat into crypto requirestrades(UK retail users have a 24-hour post-onboarding cooldown before trading). - For APM buys, the Payment Widget is set up in your frontend.
- The integration uses Uphold’s rails. Partner-owned rails (omnibus) follow a different flow not covered here.
Walkthrough
Select a crypto to buy
Call List assets to retrieve the assets available on the platform. Filter to assets that includebuy in their features array to show only purchasable assets.
BTC in this example) becomes the destination.asset for the buy.
Call List accounts to find the user’s existing Uphold accounts for that asset.
destination of the buy.
Define the source
The source is the fiat payment method that funds the buy.Bank transfers are push deposits: the user sends the funds from their bank to deposit details, so they don’t follow this guide. See the bank transfer deposit guides. SEPA and FPS deposit details can target the crypto account directly, which converts the deposit into the crypto when it settles.
Card
Check available rails
Call List Rails to verify that a card rail with thedeposit feature is available.
Link or select the card
Let the user link a new card or select an existing one. The card external account is theorigin of the buy.
Call List external accounts to fetch the user’s saved cards.
status: "ok" and deposit in features.
This sends the full card number and security code through your systems, which requires your organization to be PCI DSS compliant. If it isn’t, link cards through the Payment Widget, which collects the card details itself, with its flow.
status: "processing" while the card is validated.
ok and the full details are available.
Monitor the external account status via Get external account or the
core.external-account.status-changed webhook until status is ok before proceeding.EMD disclaimer
This disclaimer is required to comply with FCA regulations. Display it to users based in GB, the first time they link a credit/debit card or generate bank deposit details — it only needs to be shown once:Uphold Europe Limited is an EMD Agent of Optimus Cards UK Limited (FRN: 902034). All received funds are held in a designated safekeeping account with a regulated bank and kept separate from Uphold’s own assets. These funds are not protected by the UK Financial Services Compensation Scheme.
Alternative payment method (APM)
Check available rails
Call List Rails withtype=apm to find the APMs the user can pay with: those whose features include deposit.
Define the APM origin
The origin is either:- An
apmnode with themethodthe user pays with, such aspaypal. No external account is needed. - A saved APM account, referenced by the
idof its external account (from List external accounts).
Transaction preview
Show the user a preview of the buy before committing. Create a quote from the payment method to the crypto account: it converts the fiat into the crypto at a locked rate.denomination sets the amount and the asset it’s expressed in, and target whether it’s the amount the user pays (origin) or receives (destination).
Present origin.amount (what the payment method is charged), destination.amount (the crypto the user receives) and the fees to the user.
Quotes are short-lived. Use
refreshAt to drive re-quoting: if the user hasn’t confirmed by then, create a new quote and show the updated amounts, since there’s no refresh endpoint. The quote’s expiresAt is equal to or later than refreshAt, to give the user time to complete an external action needed to proceed, such as authorizing an APM payment.Card
Quote from the card to the crypto account.Alternative payment method (APM)
Quote from the APM to the crypto account, with theapm node as the origin. The quote lists the authorize:* requirement of the method, such as authorize:paypal.
Confirm quote
Card
Commit the buy by calling Create transaction with the quote ID. Always include theauthorize:3ds requirement — the card issuer may require 3DS authorization. You may embed stateful data in the returnUrl query parameters to resume the flow after redirect.
Include the X-Uphold-User-Ip and X-Uphold-User-Agent headers with the end user’s IP and user agent. They’re required when a returnUrl is sent, and they’re used for the 3DS risk evaluation.
origin.node.confirmationUrl is present, redirect the user to that URL to complete the 3DS challenge. After completion, the issuer redirects the user back to your returnUrl.
Alternative payment method (APM)
Don’t create the transaction yourself. Hand off to the Payment Widget: call Create widget session to start thetransaction:authorize flow, passing the quoteId and the authorize:* requirement of the quote, and the widget authorizes the payment with the provider and creates the transaction. See the APM deposit guides for the session, the widget setup and its events.
Monitor for settlement
Monitor the transaction by listening forcore.transaction.status-changed webhooks or polling.
Via webhooks
Subscribe tocore.transaction.status-changed. The event fires on every status transition; filter on data.transaction.status to detect terminal states:
completed— transaction settled successfullyfailed— transaction failed;data.transaction.statusDetails.reasonsays why. See Failure reasons
Via polling
GET /core/transactions/{transactionId} returns the current state. Use polling as a fallback when webhook delivery cannot be guaranteed. Terminal statuses are completed and failed.
Notify the user
Display a confirmation when thecore.transaction.status-changed webhook fires with status: "completed": the crypto is now credited to the user’s Uphold account. Show both the amount charged and the crypto received.
You now support crypto buy via the REST API.
Sample transaction
A card buy charges the card in fiat, converts at the locked quote rate, and credits the crypto to the user’s crypto account, all in one transaction. The transaction fires acore.transaction.status-changed webhook on completion.
Request errors
Create quote and Create transaction reject a request with an HTTP error when it can’t go ahead, in which case no transaction is created. The table only lists the errors your integration should act on, such as by showing the user a message. The other errors usually point to an issue in your integration. See the API reference of each endpoint for the full list. For an APM, the Payment Widget creates the transaction, so the errors of Create transaction reach you through itserror event instead: an authorize_transaction_failed error whose event.detail.error.cause is the original error, with the status in httpStatusCode and the same code and details as in the table. The errors of Create quote are returned to your backend as usual.
Failure reasons
A transaction that was created can still fail afterwards: itsstatus becomes failed, or on-hold when information is requested, and statusDetails.reason says why. You learn about it through the core.transaction.status-changed webhook, or by polling Get transaction. The table only lists the reasons your integration should act on, such as by notifying the user.