Skip to content

Sell widget (C2F)

This document describes the steps to take in order to embed the BTC Direct sell order form widget in another website. It is aimed at developers that will implement this functionality.

In order to enable the widget in your website, the following script needs to be embedded. This script loads the widget from the BTC Direct CDN (Content Delivery Network) and initializes it automatically.

<script lang="js">
(function (btc, d, i, r, e, c, t) {
btc[r] = btc[r] || function () {
(btc[r].q = btc[r].q || []).push(arguments)
};
c = d.createElement(i);
c.id = r; c.src = e; c.async = true;
c.type = 'module'; c.dataset.btcdirect = '';
t = d.getElementsByTagName(i)[0];
t.parentNode.insertBefore(c, t);
})(window, document, 'script', 'btcdirect',
'https://cdn.btcdirect.eu/coin-to-fiat/coin-to-fiat.js'
);
btcdirect('init', { token: 'API_KEY' });
</script>

If a valid key is provided, and the styling is added, it will result in the following:

The init call, as described in Getting Started, can contain several key-value pairs to fine-tune the widget. The different options are described below.

KeyTypeDescriptionDefault
returnUrlstringThe url that is used in some places in the widget once the user is redirected to a specific external page of BTC Direct.The url of the page that the widget is loaded in.
useSameWindowForPaymentbooleanSetting this to false opens the IBAN verification page in a new window instead of navigating the current window to the IBAN verification page.true

All widgets support selector, debug, locale and theme.

If you provide the widget with wallet addresses, it will require the user to select a wallet address in order to submit the form. The above preview has (demo) addresses provided and therefore shows the wallet address selector accordingly.

Wallet addresses are optional and not required, if you don’t provide them the address selector will not be shown.

The selected wallet address will be available to you through an emitted event, which you can read more about in Sell widget: events