The Fields Object

fields.create(type, options)

var card = fields.create('pin');

This method creates an instance of a specific Smart Field. It takes the type of Smart Field to create as well as an options object.


You need to create a container DOM element to mount a Smart Field.

<div id="virtual-card-field"></div>

The field.mount() method attaches your Field to the DOM. field.mount() accepts either a CSS Selector (e.g., '#card-field') or a DOM element.


field.on(event, handler)

The only way to communicate with your Smart Field is by listening to an event. Fields might emit any of the events below. All events have a payload object that has a fieldType property with the type of the Field that emitted the event.

readyTriggered when the Field is mounted and loaded in the DOM.
external-errorTriggered when an error occurs getting data from the server (e.g: virtual card data).