getCoinbaseBuyUrl
Gets a Coinbase buy URL for initiating a fiat-to-crypto purchase flow. This is the simplest way to integrate Coinbase onramp - the URL opens in a new tab or popup window where the user completes the purchase on Coinbase’s site. Use this when you want a simple redirect-based flow. For an embedded iframe experience with real-time event tracking, use createCoinbaseOnrampOrder instead.Usage
Parameters
Returns
Promise<{ url: string }> - A promise that resolves to an object containing the Coinbase buy URL.
Examples
Open in popup window
Full page redirect
When to use getCoinbaseBuyUrl vs createCoinbaseOnrampOrder
React
useGetCoinbaseBuyUrl is a query hook:
Related functions
- createCoinbaseOnrampOrder - Create an embedded onramp order with event tracking
- createCryptoDotComPayment - Create a Crypto.com payment