This page provides detailed information about configuring the TwoCoin widget using URL parameters. You can customize various aspects of the widget to match your needs and user experience requirements.
The widget is configured using URL parameters. These parameters allow you to pre-configure various aspects of the widget:
Parameter | Type | Description | Example |
---|---|---|---|
walletAddress | String | Pre-configured wallet address (read-only in UI) | 0x1234567890abcdef |
hideWallet | Boolean | Hide wallet address section (requires walletAddress) | true |
country | String | Pre-configured country code (read-only in UI) | US |
state | String | Pre-configured state code (requires country) | NY |
hideCountryAndState | Boolean | Hide country/state section (requires country) | true |
fromCurrency | String | Pre-configure the source currency | USD |
toCurrency | String | Pre-configure the target currency | BTC |
lockCurrencies | Boolean | Lock currency selection to prevent changes | true |
hideOrders | Boolean | Hide the "View Orders" button | true |
Here are examples of how to configure the widget using URL parameters:
<!-- Basic iframe integration -->
<iframe
src="https://your-widget-domain.com/widget?fromCurrency=EUR&toCurrency=ETH"
width="100%"
height="800px"
frameBorder="0">
</iframe>
<!-- Advanced configuration with multiple parameters -->
<iframe
src="https://your-widget-domain.com/widget?walletAddress=0x1234&hideWallet=true&country=US&state=NY&fromCurrency=USD&toCurrency=BTC&lockCurrencies=true&hideOrders=true"
width="100%"
height="800px"
frameBorder="0">
</iframe>
<script>
function buildWidgetUrl(baseUrl, options) {
const params = new URLSearchParams();
if (options.walletAddress) params.append('walletAddress', options.walletAddress);
if (options.hideWallet) params.append('hideWallet', 'true');
if (options.country) params.append('country', options.country);
if (options.state) params.append('state', options.state);
if (options.fromCurrency) params.append('fromCurrency', options.fromCurrency);
if (options.toCurrency) params.append('toCurrency', options.toCurrency);
if (options.lockCurrencies) params.append('lockCurrencies', 'true');
if (options.hideOrders) params.append('hideOrders', 'true');
return baseUrl + '?' + params.toString();
}
// Usage example
const widgetUrl = buildWidgetUrl('https://your-widget-domain.com/widget', {
walletAddress: '0x1234567890abcdef',
country: 'US',
fromCurrency: 'USD',
toCurrency: 'BTC',
lockCurrencies: true
});
document.getElementById('widget-iframe').src = widgetUrl;
</script>
Certain parameters work together to provide specific functionality. Here are some common combinations:
?fromCurrency=USD&toCurrency=BTC&lockCurrencies=true
This configuration:
- Sets USD as the source currency
- Sets BTC as the target currency
- Prevents users from changing the currencies
?country=US&state=NY&hideCountryAndState=true
This configuration:
- Pre-configures the location to New York, US
- Hides the country/state selection from users
?walletAddress=0x1234567890abcdef&hideWallet=true
This configuration:
- Pre-fills the wallet address
- Completely hides the wallet input from users
?walletAddress=0x1234&hideWallet=true&country=US&hideCountryAndState=true&fromCurrency=USD&toCurrency=BTC&lockCurrencies=true&hideOrders=true
This configuration provides the most streamlined experience:
- Pre-configures wallet, location, and currencies
- Hides all configuration options from users
- Focuses user attention on amount and payment selection
If you encounter any issues or have questions not addressed in this documentation, please contact our support team on Telegram at https://t.me/cs_2coin (@cs_2coin).