...
from the object returned when calling
window.Netvalve.initFields
during the JS SDK setup.
Code Block | ||
---|---|---|
| ||
const sdk = window.Netvalve.initFields({ }) await sdk.tokenizeFields(); |
From the
<netvalve-tokenfields>
html web component
Code Block | ||
---|---|---|
| ||
const sdk = document.querySelector('netvalve-tokenfields'); // GET INSTANCE const token = await sdk.tokenizeFields(); |
...
A synchronous function that checks if all required payment fields (card number, CVV, and expiry) have been successfully tokenized.
Arguments: None
Returned Value: boolean
Returns
true
if all three fields have been successfully tokenizedReturns
false
if any field is not yet tokenized or has failed tokenization
Example Usage:
Code Block | ||
---|---|---|
| ||
if (window.Netvalve.allFieldsTokenized()) { console.log('All fields are tokenized and ready for submission'); } else { console.log('Some fields still need to be tokenized'); } |
...
A synchronous function that checks if any payment field is currently in the process of being tokenized.
Arguments: None
Returned Value: boolean
Returns
true
if any field is currently being tokenizedReturns
false
if no fields are currently being tokenized
Example Usage:
Code Block | ||
---|---|---|
| ||
document.querySelector('#submit-button')?.addEventListener('click', async (e) => { if (window.Netvalve.isTokenizing()) { console.log('Please wait, tokenization in progress...'); return; } // Proceed with tokenization const token = await window.Netvalve.tokenizeFields(); }); |