Events
The event.on
function enables systems to hook into the BTAI event system for more granular access to underlying actions. These events allow you to respond to various stages of device verification, user consent, payment method validation, and payment method creation.
Event System
Examples
import React, { useEffect } from 'react';
import { useBtAi } from '@btai/react-sdk';
const { btAi } = useBtAi();
// Listen to device onboarding events
const handleEvent = (event) => {
console.log('Event:', event);
};
// Register event listeners
btAi.events.on('verify.deviceOnboarding', handleEvent);
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
event | string | Yes | Event to listen for |
callback | string | Yes | Function to trigger when event is fired |
Event Types
Event | Description |
---|---|
purchaseIntentVerify.deviceOnboarding | Triggered when user enters device on-boarding (typically 2FA) |
purchaseIntentVerify.consent | Triggered when user has entered flow to give consent for a purchase intent |
purchaseIntentVerify.cancelled | Triggered when user cancelled the verify flow |
purchaseIntentVerify.granted | Triggered when user confirmed consent |
purchaseIntentVerify.complete | Triggered when the verification process has completed |