Additional Method Calls to the Widgets
The widget accepts several calls to it with which additional information can be provided. These can be added to the script tag that loads the widget.
// JavaScript from previous code example
btcdirect('init', { token: 'API_KEY' });
btcdirect('wallet-addresses', {
addresses: {
address: 'mipcBbFg9gMiCh81Kj8tqqdgoZub1ZJRfn',
currency: 'BTC'
}
});
It isn’t necessary to call this synchronously though. The method is set as a global variable, so you can also call it from other places in your page or scripts. The below examples call the functionality using the global variable name and as two window variables.
btcdirect('wallet-addresses', {
addresses: {
address: 'mipcBbFg9gMiCh81Kj8tqqdgoZub1ZJRfn',
currency: 'BTC'
}
});
// or
window.btcdirect('wallet-addresses', {
addresses: {
address: 'mipcBbFg9gMiCh81Kj8tqqdgoZub1ZJRfn',
currency: 'BTC'
}
});
// or
window['btcdirect']('wallet-addresses', {
addresses: {
address: 'mipcBbFg9gMiCh81Kj8tqqdgoZub1ZJRfn',
currency: 'BTC'
}
});
This enables you to get necessary data from your own backend (for example the wallet addresses of the user) and pass it to the widget.
Locale
This call sets the locale for the application. This determines the way monetary values are displayed. For example 0 Euro’s in the EN-GB locale is displayed as “€0.00” whereas the NL-NL locale results in “€ 0,00”.
btcdirect('locale', { locale: 'en-GB' });
If the locale of your application is not changeable, we advise setting the locale in the main init call parameters.