Functions
Callback functions allow you to customize the logic of the form.
FTCaptures.init(...)
FTCaptures.init(...)
This function initializes the configuration for a specific route in a given environment. Here is an explanation of how the function works:
The function takes three parameters:
routeID
(the ID of the route)environment
(the environment in which the route is being initialized)callback
(a function to be executed after the initialization is complete)tags
(an array of tags to identify the permanent token). Optional (Only is utilized when the inbound route has been set up with a permanent token).
FTCaptures.on(...)
FTCaptures.on(...)
This function provides a convenient way to register multiple event handlers for different events and allows for easy execution of the registered callbacks when the corresponding events occur.
You can use the on
function to subscribe to the following events:
cardHolderValidationFailed
cardNumberValidationFailed
cardExpirationDateValidationFailed
cardSecurityCodeValidationFailed
expirationYearValidationFailed
expirationMonthValidationFailed
textValidationFailed
AmountValidationFailed
selectValidationFailed
radioValidationFailed
Here's an example of how you can subscribe to an event:
FT.field(...)
FT.field(...)
Field function creates a field within a specified container using an <iframe>
. Here is an explanation of how the function works:
The function takes two parameters:
selector
(the id selector for the container element)options
(an object containing configuration options for the field).
It checks if the
routeID
property is set. If not, it throws an error indicating that the SDK must be initialized before creating fields.
FTCaptures.tokenize(...)
FTCaptures.tokenize(...)
Tokenize function prepares the fields within a specified route for tokenization. Here is an explanation of how the function works:
The function takes one parameter:
routeID
(the ID of the route).It sets the
routeID
property of the current object (this
) to the providedrouteID
.The function returns a new Promise that takes two parameters:
resolve
andreject
. These parameters are used to handle the asynchronous result of the tokenization process.
FTCaptures.validate(...)
FTCaptures.validate(...)
The validate
function performs field validation for a specified route. Here is an explanation of how the function works:
The function takes one parameter:
routeID
(the ID of the route).The function returns a new Promise that takes two parameters:
resolve
andreject
. These parameters are used to handle the asynchronous result of the validation process.An object
validationResults
is created to store the validation results for each field.
Overall, this function performs field validation for a specified route by sending messages to the content windows of the associated <iframe>
elements and listening for validation results. The Promise is resolved with the validation results when all fields have been validated.
FTCaptures.destroy(...)
FTCaptures.destroy(...)
This function removes the fields associated with a specified route and destroys any active instances. The function takes one parameter: routeID
(the ID of the route).
Overall, this function removes the <iframe>
elements associated with a specified route from the DOM and destroys any active instances associated with that route.
Last updated
Was this helpful?