VA
Acceptance

Events Reference

Framework lifecycle events and custom component events

Event System

The SDK emits lifecycle events that allow you to track component state transitions, authentication flows, and errors.

VisaAcceptance.init({
  onEvent: (type, payload) => {
    switch (type) {
      case 'component_ready':
        console.log('Component loaded:', payload.componentName);
        break;
      case 'component_error':
        console.error('Error:', payload.error);
        break;
    }
  },
});

Framework Events

EventDescriptionPayload
sdk_loadedSDK script initialized
component_createComponent instance createdcomponentName, instanceId, version
component_mountComponent iframe inserted into DOMcomponentName, instanceId, containerElement
component_readyComponent fully loaded and interactivecomponentName, instanceId, loadTime
component_unmountComponent destroyedcomponentName, instanceId
component_errorComponent encountered an errorerror, componentName, instanceId
auth_requiredAuthentication neededreason, componentName, instanceId
auth_completeAuthentication succeededcomponentName, instanceId, authDuration
auth_timeoutAuthentication timed outcomponentName, instanceId, timeout
auth_token_refresh_startToken refresh initiated
auth_token_refresh_completeToken refresh succeeded
auth_token_refresh_failedToken refresh failed after all attempts

Event Payload Types

ComponentReadyEvent

Prop

Type

ComponentErrorEvent

Prop

Type

AuthRequiredEvent

Prop

Type

Error Handling

When a component_error event fires, the payload contains a ComponentError object. See the Error Codes reference for the full error code table and recovery patterns.

On this page