CardInputEvent

Input event emitted from the Card and Fields payment method instances.

This object contains the current and previous state of an input field that triggered a card input event on buyer actions such as selecting a field, inputting a value, or selecting the next input field.

Properties

cardInputEvent.js
JS
JavaScript

card.addEventListener("cardBrandChanged",  async (cardInputEvent) => {

  const eventMessage = `Brand ${cardInputEvent.detail.cardBrand}

  Valid input? ${cardInputEvent.detail.currentState.isCompletelyValid}

  event type ${cardInputEvent.detail.eventType}

  focused field ${cardInputEvent.detail.field}

  Postal code ${cardInputEvent.detail.postalCodeValue}

  Field empty on focus? ${cardInputEvent.detail.previousState.isEmpty}`

  alert(eventMessage);

});