---
updatedAt: 2026-08-18T10:29:23.000Z
agentTools:
  projectIndex: https://docs.wert.io/llms.txt
---

# Listeners object

The listeners object helps you keep track of events in the module and respond accordingly.

The following events are available:

| Event          | Expected data                                                                                                                                                                                                                                | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| :------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| close          | undefined                                                                                                                                                                                                                                    | It's triggered when the user closes a widget.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| error          | \{<br />name: String;<br />message: String;<br />}                                                                                                                                                                                           | Widget error message (not payment-related), see [error codes.](https://docs.wert.io/docs/error-codes)                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| loaded         | undefined                                                                                                                                                                                                                                    | It indicates the module is loaded with necessary data and ready to receive extra data if needed.<br />This event may duplicate if the user is redirected to their bank's 3-D Secure verification page.                                                                                                                                                                                                                                                                                                                                   |
| payment-status | \{<br />status: String<br />payment\_id: String<br />order\_id: String<br />tx\_id: String // if available  external\_order\_id: string;<br />}                                                                                              | Possible statuses: <br />`pending`, `canceled`, `failed`, `success`.<br />Events may not be unique for each status.<br />`tx_id` appears in the `pending` status.                                                                                                                                                                                                                                                                                                                                                                        |
| position       | \{<br />step: String<br />}                                                                                                                                                                                                                  | Notifies changes in user flow position.<br />const names = \{<br />account: 'account',<br />accountHistory: 'account-history',<br />accountCard: 'account-card',<br />accountAddress: 'account-address',<br />home: 'home',<br />wallet: 'wallet',<br />login: 'login',<br />onboarding: 'onboarding',<br />card: 'card',<br />verification: 'verification',<br />verificationStatus: 'verification-status',<br />orderReview: 'order-review',<br />orderStatus: 'order-status',<br />warranty: 'warranty',<br />error: 'error',<br />}; |
| rate-update    | \{<br />ticker: String,<br />fee\_percent: String,<br />currency\_amount: String,<br />fee\_amount: String,<br />commodity\_amount: String,<br />purchase\_amount: String,<br />miner\_fee: String,<br />currency\_miner\_fee: String<br />} | Updates when the widget rate changes. We fix the exchange rate for 30 seconds.                                                                                                                                                                                                                                                                                                                                                                                                                                                           |

<br />

Add the listeners object like this: the key is the event type, and the value is your callback function.

```javascript
const widget = new WertWidget({
  ...options,
  listeners: {
    position: (data) => console.log("step:", data.step),
  },
});
```

<br />

To subscribe to the payment status data, you can do the following:

```javascript
const widget = new WertWidget({
  ...options,
  listeners: {
    'payment-status': data => console.log('Payment status:', data)
  },
});
```

This will only be triggered when simulating the purchase, not in intermediary steps.