Buy widget: parameters
You can prefill and control the buy widget by calling set-parameters after initialization.
Set parameters
Section titled “Set parameters”btcdirect('set-parameters', { baseCurrency: 'BTC', quoteCurrency: 'EUR', baseCurrencyAmount: 0.001, quoteCurrencyAmount: 123, paymentMethod: 'creditCard', walletAddress: '3FZbgi29cpjq2GjdwV8eyHuJJnkLtktZc5', walletAddressTag: '1513155290', signature: '67890fghij', returnUrl: 'https://example.com', callbackUrl: 'https://example.com/callback', partnerOrderIdentifier: '12345abcde', fee: 0.5, expiryDateTime: 1701423182, fixedAmount: true, fixedCurrency: true, fixedPaymentMethod: true, showWalletAddress: true});All parameters are optional. Only provide the fields you want to prefill.
| Key | Type | Description |
|---|---|---|
baseCurrency | string | The cryptocurrency to preselect |
quoteCurrency | string | The fiat currency to preselect |
baseCurrencyAmount | number | The crypto amount to prefill |
quoteCurrencyAmount | number | The fiat amount to prefill |
paymentMethod | string | The payment method to preselect. See payment methods. |
walletAddress | string | The wallet address of the user |
walletAddressTag | string | The destination tag of the wallet (if applicable) |
signature | string | Signature from an offer API call (see below) |
returnUrl | string | URL to return to when clicking “Back to partner” |
callbackUrl | string | URL where order status updates are sent |
partnerOrderIdentifier | string | Your order ID |
fee | number | A specific fee for this order (as a percentage) |
expiryDateTime | string | Unix timestamp from an offer API call (see below) |
fixedAmount | boolean | Lock the amounts so they cannot be changed |
fixedCurrency | boolean | Lock the currencies so they cannot be changed |
fixedPaymentMethod | boolean | Lock the payment method so it cannot be changed |
showWalletAddress | boolean | Show or hide the wallet address of the user |
Offer API parameters
Section titled “Offer API parameters”The signature and expiryDateTime parameters come from the Unified Checkout API response. Providing them ensures the same offer is used for the order.
Other method calls
Section titled “Other method calls”Set locale
Section titled “Set locale”btcdirect('locale', { locale: 'en-GB' });Set currencies
Section titled “Set currencies”btcdirect('currencies', { crypto: 'BTC', fiat: 'EUR' });Lock cryptocurrency
Section titled “Lock cryptocurrency”btcdirect('currencies', { crypto: 'ETH', fiat: 'EUR' });btcdirect('lock-cryptocurrency', { lockCryptocurrency: true });Prefill order
Section titled “Prefill order”btcdirect('order', { crypto: 'LTC', fiat: 'EUR', amount: 1, type: 'crypto' // or 'fiat'});Set payment method
Section titled “Set payment method”btcdirect('payment-method', { method: 'iDeal' });Set callback URL
Section titled “Set callback URL”btcdirect('callback', { callbackUrl: 'https://example.com/callback' });Skip the order form
Section titled “Skip the order form”Skips the order form if all required data is provided (amount, currency, wallet address, payment method):
btcdirect('attempt-direct-confirm', { enableAttemptDirectConfirm: true });Include DCA tab
Section titled “Include DCA tab”Adds a Dollar Cost Averaging tab to the buy widget:
btcdirect('include-dca', { include: true });Set partner order identifier
Section titled “Set partner order identifier”btcdirect('partner-order-identifier', { partnerOrderIdentifier: '12345abcde' });