Make use of Secure Fields callback events
Use the secureFields.on(...) callback function to subscribe to events.
on ready
on error
on copyToClipboard
The ready event will be emitted once the iframes are loaded.
secureFields.on("ready", function() {
// fields have been rendered
secureFields.on("error", function(data) {
// something bad happened
The copyToClipboard event will be emitted if a value has been successfully copied to clipboard. This could be used to show a hint to the user.
secureFields.on("copyToClipboard", function(data) {
if (data.result === 'error') {
console.error('Error copying ' + data.field + ' to clipboard!. Reason: ' + data.error);
console.log(data.field + ' copied to clipboard!'); // field is either "cardNumber" or "cvv"