Skip to main content
Prefill all query string parameters in the Onramp URL and take users straight to the order preview screen! If a user does not have an active Coinbase account session, they are taken to Guest Checkout. There are a few ways to generate a One-Click-Buy URL:
  1. Get a ready-to-use URL directly from the Buy Quote API by including the destination_address parameter
Security Requirements must be enforced: Your backend API that generates session tokens must implement proper security measures. See Security Requirements for complete implementation guidance.
  1. Use the getOnrampBuyUrl util to generate a URL
Specify all the parameters in the util to get one-click-buy experience
Should my App use One-click-buy?If your users have already selected the asset they want to buy, an amount, and/or a payment method in your App, yes. If you want to preset these values for your users, yes.

Generating One-Click-Buy URLs

One-Click-Buy URLs must have following query parameters set in the URL:
  • presetFiatAmount or presetCryptoAmount
  • fiatCurrency required for presetFiatAmount
  • defaultAsset (can be omitted when session token specifies only one asset)
Then it initializes Coinbase Onramp with the appropriate parameters to execute that buy. For example:
https://pay.coinbase.com/buy?defaultAsset=ETH&fiatCurrency=USD&presetFiatAmount=10&sessionToken=MWYwNmYwZmQtNDQwYy02OTFkLTllNGEtMjJhMjIxNzY3ODM5
Send only URL:
https://pay.coinbase.com/buy?defaultAsset=USDC&defaultPaymentMethod=CRYPTO_ACCOUNT&presetCryptoAmount=10&sessionToken=MWYwNmYwZmQtNDQwYy02OTFkLTllNGEtMjJhMjIxNzY3ODM5

Query parameters

ParameterReqdTypeDescription
sessionTokenYesStringToken generated by the Session Token API.
defaultAssetYesStringUUID of asset. optional if session token contains a single asset.

Received from Onramp Options and sent to Buy Quote.
presetFiatAmountYesNumberAmount in fiat to be spent on the crypto purchase, fees included.
presetCryptoAmountYesNumberUse this instead of presetFiatAmount with defaultPaymentMethod set to CRYPTO_ACCOUNT for send only.
fiatCurrencyYesStringTicker symbol of the fiat currency. Required only when using presetFiatAmount.
I