This guide will help you get started with integrating the TwoCoin widget into your website. Follow these steps to begin offering cryptocurrency exchange functionality to your users.

Integration Steps

Integrating the TwoCoin widget is a straightforward process:

  1. 1. Register as a merchant and obtain your widget credentials
  2. 2. Add the widget HTML snippet to your website
  3. 3. Configure the widget parameters
  4. 4. Test the integration

Widget Integration Methods

The TwoCoin widget can be integrated into your website using the following methods:

Method 1: Iframe Integration (Recommended)

The simplest way to integrate the widget is using an iframe with URL parameters:

<iframe
  src="https://your-widget-domain.com/widget?paramName=value"
  title="TwoCoin Widget"
  width="100%"
  height="800px"
  frameBorder="0">
</iframe>

Method 2: Direct Link Integration

You can also redirect users directly to the widget page with configuration parameters:

<a href="https://your-widget-domain.com/widget?paramName=value" 
   target="_blank" 
   class="widget-button">
  Buy Cryptocurrency
</a>

<!-- Or redirect programmatically -->
<script>
  function openWidget() {
    const params = new URLSearchParams({
      walletAddress: '0x1234567890abcdef',
      country: 'US',
      state: 'NY',
      fromCurrency: 'USD',
      toCurrency: 'BTC'
    });
    
    const widgetUrl = 'https://your-widget-domain.com/widget?' + params.toString();
    window.open(widgetUrl, '_blank');
  }
</script>

URL Configuration Parameters

The widget is configured through URL parameters. You can pre-configure various aspects of the widget by passing parameters in the URL. See the Widget Configuration section for detailed information.

Available URL Parameters

ParameterDescriptionExample
walletAddressPre-configured wallet address (read-only in UI)0x1234567890abcdef
hideWalletHide wallet address section (requires walletAddress)true
countryPre-configured country code (read-only in UI)US
statePre-configured state code (requires country)NY
hideCountryAndStateHide country/state section (requires country)true
fromCurrencyPre-configure the source currencyUSD
toCurrencyPre-configure the target currencyBTC
lockCurrenciesLock currency selection to prevent changestrue
hideOrdersHide the "View Orders" buttontrue

Example URL with Parameters

https://your-widget-domain.com/widget?walletAddress=0x1234567890abcdef&hideWallet=true&country=US&state=NY&fromCurrency=USD&toCurrency=BTC&lockCurrencies=true&hideOrders=true

Next Steps

Support

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).