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

ParameterTypeRequiredDescription
eventstringYesEvent to listen for
callbackstringYesFunction to trigger when event is fired

Event Types

EventDescription
purchaseIntentVerify.deviceOnboardingTriggered when user enters device on-boarding (typically 2FA)
purchaseIntentVerify.consentTriggered when user has entered flow to give consent for a purchase intent
purchaseIntentVerify.cancelledTriggered when user cancelled the verify flow
purchaseIntentVerify.grantedTriggered when user confirmed consent
purchaseIntentVerify.completeTriggered when the verification process has completed