Menu

Class: MicroformInstance v0.4.4

An instance of this class is returned upon the creation of a Flex Microform integration using 
module:FLEX.microform
 (see  {void}"" title="" data-scope="local" data-format="dita" data-type="" target="_self" >"(static) microform(options, callback) > {void}"). This provides methods to interact with the Flex Microform iframe and to access the various integration hooks available.

Methods

clear()
Programmatically clears any entered value in the 
card number
field.
Example
microformInstance.clear();
createToken(options, callback)
Requests a token using the card data that is entered on the form.
A successful token creation will receive a Flex API 
token
 response as its second callback parameter.
disable()
Disables the 
card number
 field from user input.
Example
microformInstance.disable();
enable()
Enables the 
card number
 field for user input.
Example
microformInstance.enable();
focus()
Enables the 
card number
 field for user input.
Example
microformInstance.focus();
off(name, event)
Unsubscribes a specific event handler from MicroformInstance.
Parameters
Name
Type
Description
name
String
The event to which you want to unsubscribe.
the
function
The handler to execute when you want to unsubscribe to an event.
Example
// subscribe to an event using .on() but keep a reference to the handler that was supplied. var focusHandler = function() { console.log('focus received'); } microformInstance.on('focus', focusHandler); // then at a later point you can remove this subscription by supplying the same arguments to .off() microformInstance.off('focus', focusHandler);
on(name, event)
Subscribe to events emitted by 
MicroformInstance
. The following event types are supported:
Some events may return data as the first parameter to the callback; otherwise, it will be 
undefined
. See "Events v0.4.4." for information about the event details listed above.
Parameters
Name
Type
Description
name
String
The event to which you want to subscribe.
event
function
The handler to execute when event is triggered.
Example
microformInstance.on('notEmpty', function() { console.log('Input field is no longer empty!'); });
setPlaceholder(text)
Sets the placeholder text on the 
card number
 field.
Parameters
Name
Type
Description
text
String
Applied to the 
placeholder
 attribute of the input field.
Example
The following example displays how to set the custom placeholder text to fit your user experience:
microformInstance.setPlaceholder('xxxx xxxx xxxx xxxx');
The following example displays how to provide a custom prompt for your customer using placeholder text:
teardown(callbackopt)
Completely disposes of the 
MicroformInstance
.
Parameters
Name
Type
Attributes
Description
callback
callback
<optional>
Examples
microformInstance.teardown(function() { console.log('Teardown complete!'); });

Type Definitions

createTokenResponse
Response format of a successful createToken call (see "createToken(options, callback)").
Type
Object
Properties
Name
Type
Description
keyId
String
Id of the public key used in creating this token.
token
String


The generated token. The token replaces card data


and is used as the Subscription ID in the

CyberSource Simple Order API or SCMP API.
maskedPan
String
The masked card number. Masking settings can be


determined in the creation of the Keys resource, the


default displaying the first 6 digits and the last 4

digits.
cardType
String


The three digit CyberSource card type code of the

PAN used to create this token. 
timestamp
Number


The UTC date and time in milliseconds at which the

signature was generated. 
signedFields
String


Comma separated list indicating which fields from


the response make up the data used when verifying

the response signature.
signature
String


Digital signature that should be verified server-side,


using the public key. This ensures that values have


not been tampered with whilst passing through the

client.
discoverableServices
Object


Links to follow-on CyberSource RESTful services if

available.
_embedded
Object
Transactional metadata related to token creation.
Back to top