---
title: Events
description: What the buy widget tells your page, and how to answer it.
---

The widget dispatches events on `window`. Listen with `addEventListener`; the
data is in `event.detail`:

```js
window.addEventListener('EVENT_NAME', (event) => {
  console.log(event.detail);
});
```

## Order confirmed

The customer confirmed their order and is about to pay.

Event name: `btcdirect-embeddable-fiat-to-coin-order-confirmed`

```js
// event.detail
{
  currencyCode: 'iso:EUR',
  exchangeAmount: 100,
  orderId: '3f2b8c1e-…'
}
```

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `currencyCode` | string | optional | The fiat currency being paid. |
| `exchangeAmount` | number | optional | The fiat amount being paid. |
| `orderId` | string | optional | The order’s id. It is what your webhooks arrive with. |

## Wallet confirmation requested

Sent when `walletConfirmationRequired` is `true`. Verify the address in your app,
for example on the customer's hardware wallet, then confirm or cancel.

Event name: `btcdirect-embeddable-wallet-address-confirmation-requested`

```js
// event.detail
{
  id: '123456789',
  address: 'bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq'
}
```

`id` is the one you gave the wallet in [wallet addresses](https://partner.btcdirect.eu/v2/widget/buy/wallet-addresses.md).

Confirm the address:

```js
btcdirect('wallet-address-confirmation', { address: 'bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq' });
```

Or cancel, which returns the customer to the order form:

```js
btcdirect('wallet-address-confirmation-canceled');
```

## Account events

Every widget sends these, with no detail, so you can follow the customer through
signing up and in:

- **btcdirect-embeddable-registration-started** — The customer started creating an account.
- **btcdirect-embeddable-registration-completed** — They finished it.
- **btcdirect-embeddable-user-signed-in** — The customer signed in.
- **btcdirect-embeddable-user-identified** — The widget recognised a customer you named with `userIdentifier`.
- **btcdirect-embeddable-user-signed-out** — The customer signed out.

## What happens to the order next

Payment, the trade and delivery are reported through [webhooks](https://partner.btcdirect.eu/v2/webhooks.md).
