Widget display methods

After creating and configuring the widget, you can use a few methods to control the widget's display.

Please make sure you use the latest version of SDK (6.x.x).


You can use the following widget class methods:

MethodDescription
openMount the widget in the DOM and make it visible.
closeClose the widget modal.
updateThemeSwitch the widget's theme without reloading it.
addEventListenersAdd event listeners. You can find more info on the event listeners in the listeners object page.
removeEventListenersRemove event listeners.

The open() method will initialize the widget as an iFrame.

wertWidget.open();

You can switch the widget's theme without reloading it; please note this method should be called only after the widget is fully loaded:

wertWidget.updateTheme({
  theme: 'dark', // Use 'undefined' for the default light theme. 
  colors: {
    // Can be in any suitable format (string, HEX, rgb etc.)
    color_buttons: 'red',
  },
});

You can listen to widget events:

wertWidget.addEventListeners({
  position: data => console.log('step:', data.step),
});

Here are the options to remove event listeners:

wertWidget.removeEventListeners('rate-update');
//or

wertWidget.removeEventListeners([ 'rate-update', 'payment-status' ]);
//or

wertWidget.removeEventListeners();


Documentation related to this page