getOnrampBuyUrl
utility is a helper method to generate a Coinbase Onramp URL. It helps you customize the funding
experience for your users. For example:
- Setting a default buy/send amount, defaultAsset, or defaultNetwork
- Setting a redirect URL to return your users to your app after they complete the fund flow
Session Token Required: This utility requires a session token generated on your backend server using your CDP API keys. The session token encapsulates user addresses, supported assets, and client IP.Note: Restricting assets and addresses are done during session token creation on your backend.See Session Token Authentication for implementation details.
Usage
Returns
string
- Returns a full Coinbase Onramp URL that you can redirect your users to, or open in a popup.
Parameters
GetOnrampUrlParams
Session Token Generation
Session tokens must be generated on your backend server using the CDP API. The token encapsulates:- User wallet addresses
- Supported assets and blockchains
- Client IP address