Supported swap parameters
Onramper lets you customize your swap experience by adding parameters to the widget URL.
| Parameter | Type | Description |
|---|---|---|
| swap_defaultSource | string | The default source token to be displayed. |
| swap_defaultTarget | string | The default target token to be displayed. |
| swap_defaultAmount | string | The default amount to be displayed (must be used with swap_defaultSource). |
| swap_sourceWallets | string | Specifies source wallet addresses for individual tokens in the swap widget. |
| swap_sourceNetworkWallets | string | Provides a source wallet address for all tokens on a specific blockchain network. |
| swap_targetWallets | string | Defines target wallet addresses for individual tokens in the swap widget. |
| swap_targetNetworkWallets | string | Specifies a target wallet address for all tokens on a particular blockchain network. |
| swap_excludeCryptos | string | The cryptocurrencies to be excluded (applies both to source and destination currencies). |
| swap_onlyCryptos | string | The only cryptocurrencies to be displayed (applies both to source and destination currencies). |
| swap_excludeCryptoNetworks | string | The blockchain networks to be excluded (applies both to source and destination currencies). |
| swap_onlyCryptoNetworks | string | The only blockchain networks to be displayed (applies both to source and destination currencies). |
Default Source
Set a default source token to be displayed for the initial widget load using the swap_defaultSource
https://buy.onramper.com/?mode=swap&swap_defaultSource=usdc_ethereum
Default Target
Set a default target token to be displayed for the initial widget load using the swap_defaultTarget
https://buy.onramper.com/?mode=swap&swap_defaultTarget=usdc_solana
Default Amount
Set a default source amount to be displayed for the initial widget load using the swap_defaultAmount. This must be used with swap_defaultSource.
https://buy.onramper.com/?mode=swap&swap_defaultSource=usdc_ethereum&swap_defaultAmount=140
Source Wallets
The swap_sourceWallets parameter allows you to define the source wallet addresses for individual tokens used in the swap widget. Each wallet address should be formatted as a combination of the Token ID (Onramper ID) and the wallet address, separated by a colon.
For example:
BTC:3FZbgi29cpjq2GjdwV8eyHuJJnkLtktZc5.
To pass multiple addresses, separate them with commas.
BTC:3FZbgi29cpjq2GjdwV8eyHuJJnkLtktZc5,ETH:0xb794f5ea0ba39494ce839613fffba74279579268.
Source Network Wallets
The swap_sourceNetworkWallets parameter allows you to specify a source wallet address that works for all tokens on a specific blockchain network. This is particularly useful for networks that support multiple tokens. Format the parameter as the Network ID followed by the wallet address, such as
ETHEREUM:0xb794f5ea0ba39494ce839613fffba74279579268.
By utilizing this parameter, you simplify the process for users by automatically associating the source wallet with all compatible tokens on the defined network.
To pass multiple addresses, separate them with commas.
ETHEREUM:3FZbgi29cpjq2GjdwV8eyHuJJnkLtktZc5,SOLANA:0xb794f5ea0ba39494ce839613fffba74279579268.
Target Wallets
The swap_targetWallets parameter is used to define the target wallet addresses for individual tokens in the swap widget. Each wallet address should be formatted with the Token ID and wallet address separated by a colon, like:
BTC:3FZbgi29cpjq2GjdwV8eyHuJJnkLtktZc5
To include multiple target wallets, separate them with commas:
BTC:3FZbgi29cpjq2GjdwV8eyHuJJnkLtktZc5,ETH:0xb794f5ea0ba39494ce839613fffba74279579268.
Target Network Wallets
The swap_targetNetworkWallets parameter enables you to specify a single target wallet address for all tokens within a specific blockchain network. Use the Network ID followed by the wallet address in the format: NETWORK_ID:wallet_address. For example:
ETHEREUM:0xb794f5ea0ba39494ce839613fffba74279579268.
This parameter simplifies the process of targeting wallets for multiple tokens on the same blockchain, enhancing the user experience by automatically associating the wallet with the relevant tokens.
To pass multiple addresses, separate them with commas.
ETHEREUM:3FZbgi29cpjq2GjdwV8eyHuJJnkLtktZc5,SOLANA:0xb794f5ea0ba39494ce839613fffba74279579268.
Exclude Cryptos
Right out of the box, the Onramper widget makes all cryptocurrencies available for swap.
Use swap_excludeCryptos if you want to remove some from your widget. Check out Crypto currencies to find your desired IDs (please use the values from the Onramper ID column).
For instance, the example below makes ether and bitcoin unavailable to swap:
https://buy.onramper.com?mode=swap&swap_excludeCryptos=BTC,ETH
Only Cryptos
If you only want a specific set of cryptos to be displayed, for swap use onlyCryptos.
Check out Crypto currencies to find your desired IDs (please use the values from the Onramper ID column).
The string below ensures that only BTC and ETH can be swapped through your widget:
https://buy.onramper.com?mode=swap&swap_onlyCryptos=ETH,BTC
Exclude Crypto Networks
Similar to excludeCryptos, excludeCryptoNetworks allows you to remove entire crypto networks from the widget for swap: Network IDs can be found from Crypto networks - please use the values from Onramper ID column.
https://buy.onramper.com?mode=swap&swap_excludeCryptoNetworks=bitcoin,ethereum
Only Crypto Networks
onlyCryptoNetworks enables you to force the use of certain networks for swap. Network IDs can be found from Crypto networks - please use the values from Onramper ID column.
https://buy.onramper.com/?mode=swap&swap_onlyCryptoNetworks=ethereum,polygonUpdated 13 days ago
