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. Use the getOnrampBuyUrl util to generate a URL
  2. Use the <FundCard /> or <FundButton /> UI React component

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.

Manually generating One-Click-Buy URLs

Full API endpoint list

For a complete list of all API endpoints supported by Onramp/Offramp, visit our API Reference section.

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
  • defaultPaymentMethod

Then it initializes Coinbase Onramp with the appropriate parameters to execute that buy.

For example:

https://pay.coinbase.com/buy/select-asset?appId=58a3fa2e-617f-4198-81e7-096f5e498c00&addresses=[{"address":"0x750EF1D7a0b4Ab1c97B7A623D7917CcEb5ea779C","blockchains":["ethereum"]}]&defaultAsset=ETH&defaultPaymentMethod=CARD&fiatCurrency=USD&presetFiatAmount=10&quoteId=ae77980c-f656-4c69-b380-cb5cf99276a9

Send only URL:

https://pay.coinbase.com/buy/select-asset?appId=58a3fa2e-617f-4198-81e7-096f5e498c00&addresses=[{"address":"0x750EF1D7a0b4Ab1c97B7A623D7917CcEb5ea779C","blockchains":["ethereum"]}]&defaultAsset=USDC&defaultPaymentMethod=CRYPTO_ACCOUNT&presetCryptoAmount=10

Query parameters

ParameterReqdTypeDescription
defaultAssetYesStringUUID of asset.

Received from Onramp Options and sent to Buy Quote.
defaultPaymentMethodYesStringDefault payment method, one of:
  • CRYPTO_ACCOUNT
  • FIAT_WALLET
  • CARD
  • ACH_BANK_ACCOUNT
  • APPLE_PAY
Received from Buy Options and sent to Buy Quote.
fiatCurrencyYesStringTicker symbol of the fiat currency.
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.
quoteIdNoStringID of the quote. Received from Onramp Quote.
defaultNetworkNoStringDefault network that should be selected when multiple networks are present. When not set, default is the asset network.

Received from Buy Options and sent to Buy Quote.