Skip to main content
You can call the addEventListener on a Secure Fields instance or on fields, passing one of the supported events and a callback. removeEventListener removes a previously attached event handler.

Global events

The following events can be listened to by attaching an event handler to the SecureFields instance using the addEventListener method.

Field events

The following events can be listened to by attaching an event handler to a field (returned by the addCardNumberField, addExpiryDateField, addSecurityCodeField and addField methods) using the addEventListener method. Some of these provide additional useful data like the card BIN, validation status, and scheme. For example, the input event on a card number field might include { schema: 'visa', codeLabel: 'CVV', valid: true, ... }.

Reject specific card schemes

Secure Fields doesn’t block card schemes for you. To refuse cards from a scheme you don’t accept, check the scheme in the card-details-changed event, show your own error message, and don’t call submit() while that scheme is entered.