Provide Wallet Address(es)
The examples below show the methods available to add one or multiple addresses.
Provide a single address
The below example provides the widget with a single wallet address for Bitcoin.
// JavaScript from previous code example
btcdirect('init', { token: 'API_KEY' });
btcdirect('wallet-addresses', {
addresses: {
address: 'mipcBbFg9gMiCh81Kj8tqqdgoZub1ZJRfn',
currency: 'BTC',
id: '123456789',
name: 'My wallet'
}
});
Note that the id is optional and is only required when setting the wallet confirmation setting to true. See Optional init call parameters for more information. The wallet name is also optional and provides the user with more clear information on the wallet they are selecting.
Provide multiple addresses
The below example provides 3 addresses. Two are for Bitcoin and one for Ripple.
// JavaScript from previous code example
btcdirect('init', { token: 'API_KEY' });
btcdirect('wallet-addresses', {
addresses: [
{
address: 'mipcBbFg9gMiCh81Kj8tqqdgoZub1ZJRfn',
currency: 'BTC'
},
{
address: 'n1sBtodW8oz8xjwZGcZnLVoRrbQK3My8Vb',
currency: 'BTC'
},
{
address: 'rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn',
currency: 'XRP',
destinationTag: '123456'
}
]
});
Provide selected wallet address
If a wallet address was already preselected in your application, you can provide this as the default selected value in the widget.
// JavaScript from previous code example
btcdirect('init', { token: 'API_KEY' });
btcdirect('wallet-address-selected', {
addresses: {
address: 'mipcBbFg9gMiCh81Kj8tqqdgoZub1ZJRfn',
}
});
Considerations when providing wallet addresses
The wallet addresses (for example mipcBbFg9gMiCh81Kj8tqqdgoZub1ZJRfn) are example addresses and need to be replaced with the wallet address of the user. The cryptocurrency that it belongs to (for example BTC) needs to be replaced with the actual cryptocurrency abbreviation (also known as the ticker) this address belongs to.
When providing a wallet address for Ripple, and only for Ripple, you can optionally provide a destination tag (for example 123456). This is not mandatory however as not all Ripple wallet addresses require a destination tag.
Note that the wallet addresses that are provided affect the cryptocurrencies that can be selected. So if only one address for Bitcoin is provided, the only option to select in the “Choose a coin”-section will be Bitcoin. When providing addresses for multiple cryptocurrencies, the available cryptocurrencies will be selectable.
When using the sandbox environment (https://cdn-sandbox.btcdirect.eu) all provided wallet addresses need to be testnet wallet addresses. When using the production environment these need to be production wallet addresses.
List of available cryptocurrencies in our widget.