---
title: Sell widget
description: 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](https://partner.btcdirect.eu/v2/widget/getting-started.md):

```html
<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:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `returnUrl` | string | optional | Where the "Back to partner" button takes the customer. Default: the page the widget is on. |
| `partnerOrderIdentifier` | string | optional | Your own reference for the order. |
| `useSameWindowForPayment` | boolean | optional | 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](https://partner.btcdirect.eu/v2/widget/buy/wallet-addresses.md), 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](https://partner.btcdirect.eu/v2/widget/sell/events.md). Once the transfer is
broadcast, you tell the widget its transaction id:
[transaction confirmation](https://partner.btcdirect.eu/v2/widget/sell/parameters.md#transaction-confirmation).
