Sell widget
The customer sells crypto for fiat, and your app can send the crypto for them.
The sell widget takes the customer through selling: which coin, how much, the account the money goes to, and sending the crypto.
Implementing the widget
Load the sell widget's script, as in Getting started:
<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>Init options
Besides the options every widget takes:
returnUrloptional
string
Where the "Back to partner" button takes the customer. Default: the page the widget is on.
partnerOrderIdentifieroptional
string
Your own reference for the order.
useSameWindowForPaymentoptional
boolean
Accepted for compatibility. Whether a verification page opens in place or in a new window is decided by us.
Optional: wallet addresses
Pass the customer's wallets the same way as on the buy widget, and the customer picks the wallet they sell from. Without them, no wallet picker is shown.
Sending the crypto
When the customer confirms, the widget sends your page what is needed to make the transfer: the sell events. Once the transfer is broadcast, you tell the widget its transaction id: transaction confirmation.