One-click-buy Onramp URL
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:
- Use the getOnrampBuyUrl util to generate a URL
- 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
orpresetCryptoAmount
fiatCurrency
required forpresetFiatAmount
defaultAsset
defaultPaymentMethod
Then it initializes Coinbase Onramp with the appropriate parameters to execute that buy.
For example:
Send only URL:
Query parameters
Parameter | Reqd | Type | Description |
---|---|---|---|
defaultAsset | Yes | String | UUID of asset. Received from Onramp Options and sent to Buy Quote. |
defaultPaymentMethod | Yes | String | Default payment method, one of:
|
fiatCurrency | Yes | String | Ticker symbol of the fiat currency. |
presetFiatAmount | Yes | Number | Amount in fiat to be spent on the crypto purchase, fees included. |
presetCryptoAmount | Yes | Number | Use this instead of presetFiatAmount with defaultPaymentMethod set to CRYPTO_ACCOUNT for send only. |
quoteId | No | String | ID of the quote. Received from Onramp Quote. |
defaultNetwork | No | String | Default 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. |