Widget tokens expire after 5 minutes and are scoped to a specific card. Generate a new token on each page load or when the user initiates a new activation.
The widget dispatches lifecycle events across two phases:
Phase
Events
Description
Initialization
load or error (mutually exclusive)
Fires once when the widget first renders and its secure input fields load (or fail to load).
Submission
success or failure
Fires after the user submits the form.
load — Widget initialized successfully, all fields are ready for user input.
error — Widget failed to initialize (field load failure, network error, or timeout).
success — Card activation completed successfully.
failure — Card activation failed (incorrect card number, wrong CVV, expired widget token, or API error).
error fires only during widget initialization (e.g., a secure input field failed to load). If the widget loads successfully but the user’s submission fails — incorrect PAN, wrong CVV, expired token — that triggers failure, not error.
You can listen for events using either addEventListener or callback properties:
Dispatched when the widget fails to initialize. This means one or more secure input fields could not load, and the widget is not functional. Show an error message or retry UI to the user.
Property
Type
Description
instanceId
string
Unique ID for this widget instance
error
string
Human-readable error message (safe to display)
failedFields
string[]
List of field types that failed to load
<script> document.getElementById('activate-widget').addEventListener('error', (event) => { const { error, failedFields } = event.detail; console.error('Widget initialization failed:', error, failedFields); // Show error UI or offer a retry button });</script>
The load and error events are mutually exclusive — exactly one will fire during widget initialization. Always listen for both to handle all scenarios.
Dispatched after the user submits the activation form. Common failure reasons include incorrect card number, wrong CVV, and expired widget token.The success event exposes only non-sensitive status metadata:
Property
Type
Description
status
string
Submission status returned by the widget
message
string
Optional human-readable success message
instanceId
string
Unique ID for this widget instance
PAN and CVV are never included in host-page event details.