---
title: DCA widget
description: Recurring purchases, set up by the customer inside your page.
---

The customer sets up a savings plan: a coin, a wallet to receive it, and an amount
they transfer from their bank on their own schedule. Each transfer buys crypto.

## Implementing the widget

Load the DCA 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/dollar-cost-average/dollar-cost-average.js'
  );

  btcdirect('init', { token: 'API_KEY' });
</script>
```

The widget opens on an introduction for a customer without plans, and on their
plans when they have some.

## Wallet addresses

A plan needs a wallet to receive into. The customer can pick one from their own
saved addresses, type one in, or pick one you pass, the same way as on the
[buy widget](https://partner.btcdirect.eu/v2/widget/buy/wallet-addresses.md):

```js
btcdirect('init', { token: 'API_KEY' });
btcdirect('wallet-addresses', {
  addresses: { address: 'bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq', currency: 'BTC', name: 'My wallet' }
});
```

An address you pass is offered for its coin when that coin lives on one network.
For a coin on several networks, such as USDC, the customer enters the address
themselves, on the network they choose.
