/
Events
Events
Here is a list of custom events that can be listened for:
Event | Description |
---|---|
| Emitted on the |
| Emitted when a field attempts to tokenize on the Netvalve server. |
| Emitted when the input inside the iframe has finished rendering. Each field emits this. |
| 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');
}
});
, multiple selections available,
Related content
Form Submission
Form Submission
More like this
Message Data
Message Data
Read with this
Validation
Validation
More like this
Call Sale API with token
Call Sale API with token
Read with this
Styling
Styling
More like this
SDK Integration Approaches
SDK Integration Approaches
More like this