You are reading v1 & v2. v1 and v2 are deprecated. They keep working and are still supported, but new integrations should use v3.
Wallet addresses
Give the widget the customer's own wallet addresses to receive into.
If your app knows the customer's wallets, pass them in and the customer picks one instead of typing an address.
One address
btcdirect('init', { token: 'API_KEY' });
btcdirect('wallet-addresses', {
addresses: {
address: 'bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq',
currency: 'BTC',
id: '123456789',
name: 'My wallet'
}
});id is optional; you need it only with walletConfirmationRequired, where the
confirmation request names the wallet by it. name is optional too, and is what
the customer sees in the picker.
Several addresses
btcdirect('init', { token: 'API_KEY' });
btcdirect('wallet-addresses', {
addresses: [
{ address: 'bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq', currency: 'BTC' },
{ address: '3FZbgi29cpjq2GjdwV8eyHuJJnkLtktZc5', currency: 'BTC' },
{ address: 'rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn', currency: 'XRP', destinationTag: '123456' }
]
});Preselect an address
If the customer already chose a wallet in your app, preselect it:
btcdirect('wallet-address-selected', {
addresses: { address: 'bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq' }
});Things to know
currencyis the coin's ticker, such asBTC.destinationTagis for coins that use a memo or destination tag, such as XRP. It is optional: not every such address needs one.- The addresses you pass decide which coins the customer can choose. Pass only a Bitcoin address and Bitcoin is the only coin on offer.
- Use real mainnet addresses, never testnet ones.