Events
What the buy widget tells your page, and how to answer it.
The widget dispatches events on window. Listen with addEventListener; the
data is in event.detail:
window.addEventListener('EVENT_NAME', (event) => {
console.log(event.detail);
});Order confirmed
The customer confirmed their order and is about to pay.
Event name: btcdirect-embeddable-fiat-to-coin-order-confirmed
// event.detail
{
currencyCode: 'iso:EUR',
exchangeAmount: 100,
orderId: '3f2b8c1e-…'
}currencyCode
string
The fiat currency being paid.
exchangeAmount
number
The fiat amount being paid.
orderId
string
The order’s id. It is what your webhooks arrive with.
Wallet confirmation requested
Sent when walletConfirmationRequired is true. Verify the address in your app,
for example on the customer's hardware wallet, then confirm or cancel.
Event name: btcdirect-embeddable-wallet-address-confirmation-requested
// event.detail
{
id: '123456789',
address: 'bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq'
}id is the one you gave the wallet in wallet addresses.
Confirm the address:
btcdirect('wallet-address-confirmation', { address: 'bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq' });Or cancel, which returns the customer to the order form:
btcdirect('wallet-address-confirmation-canceled');Account events
Every widget sends these, with no detail, so you can follow the customer through signing up and in:
btcdirect-embeddable-registration-started- The customer started creating an account.
btcdirect-embeddable-registration-completed- They finished it.
btcdirect-embeddable-user-signed-in- The customer signed in.
btcdirect-embeddable-user-identified- The widget recognised a customer you named with `userIdentifier`.
btcdirect-embeddable-user-signed-out- The customer signed out.
What happens to the order next
Payment, the trade and delivery are reported through webhooks.