/
Events

Events

Here is a list of custom events that can be listened for:

Event

Description

Event

Description

field-validation

Emitted on the blur event when the user types.

field-tokenization

Emitted when a field attempts to tokenize on the Netvalve server.

field-initiated

Emitted when the input inside the iframe has finished rendering. Each field emits this.

fields-ready

Emitted once when all 3 fields have finished rendering.

 

Example usage

// Listen for all 3 fields rendered to the screen. window.addEventListener('fields-ready', () => { console.log('Card fields have been rendered.') }); // Listen for validation events window.addEventListener('field-validation', (event) => { const { success, message, fieldName } = event.detail; if (!success) { console.log(`Validation failed for ${fieldName}: ${message}`); } }); // Listen for tokenization events window.addEventListener('field-tokenization', (event) => { const { success, message, fieldName } = event.detail; if (success) { console.log(`${fieldName} successfully tokenized`); } else { console.log(`Failed to tokenize ${fieldName}: ${message}`); } }); // Listen for initialization window.addEventListener('field-initiated', (event) => { const { success, message } = event.detail; if (success) { console.log('TokenFieldSDK initialized successfully'); } });

Related content

Form Submission
Form Submission
More like this
Message Data
Read with this
Validation
More like this
Call Sale API with token
Call Sale API with token
Read with this
Styling
More like this
SDK Integration Approaches
SDK Integration Approaches
More like this