Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

OperationDescription
init3DSMethodCreates an HTML structure and attaches a form with a single input (threeDSMethodData) and automatically submits it to the threeDSMethodUrl.
createIframeAndInit3DSMethodCreates an iFrame with an HTML structure and attaches a form with a single input (threeDSMethodData) and automatically submits it to the threeDSMethodUrl and attaches the frame to the container. If specified, a callback will be executed when the frame is loaded. Additionally, an optional timeout duration and timeout callback can be specified to handle cases where the ACS does not complete the 3DS Method in time.
init3DSChallengeRequestCreates an HTML structure and attaches a form with a single input (creq) and automatically submits it to the acsUrl.
createIFrameAndInit3DSChallengeRequestCreates an iFrame with an HTML structure and attaches a form with a single input (creq) and automatically submits it to the acsUrl and attaches the frame to the container. If specified, a callback will be executed when the frame is loaded. Additionally, an optional timeout duration and timeout callback can be specified to handle cases where the ACS page is not loaded in time.
getBrowserDataCollects browser-specific data (browserJavaEnabled, browserJavascriptEnabled, browserLanguage, browserColorDepth, browserScreenHeight, browserScreenWidth, browserTZ, browserUserAgent) can be used initially to populate the corresponding parameters in the payment request via the silentpay interface.

Technical documentation

Code Block
languagexml
titleDocumentation
/**
 * Attach all methods to window.
 */
let nca3DSWebSDK = {};
 
/**
 * Creates an iframe, attach it to the rootContainer and submit 3DS Method form.
 *
 * @param threeDSMethodUrl - a FQDN endpoint to submit the 3DS Method request
 * @param threeDSMethodData - Base64-encoded 3DS Method Data value
 * @param frameName - name of the frame container. if not set it will be set to 'threeDSMethodIFrame'
 * @param rootContainer - the container where the iframe will be attached to.
 *                        If not set defaults to the JavaScript document.body object
 * @param onFrameLoadCallback - callback function attached to the iframe.onload event
 * @param timeoutSeconds - timeout in seconds (default: 0 = no timeout)
 * @param onFrameTimeoutCallback - callback function called when timeout occurs
 * @throws {Error} - throws error if there is a validation error
 * @returns {HTMLIFrameElement} - returns the generated iframe element
 */
nca3DSWebSDK.createIframeAndInit3DSMethod = createIframeAndInit3DSMethod;
 
/**
 * Initiates a 3DS Method request and submits the form the 3DS Method URL. It will automatically hide the container
 * when initiating a 3DS Method request.
 *
 * @param threeDSMethodUrl - a FQDN endpoint to submit the 3DS Method request
 * @param threeDSMethodData - Base64-encoded 3DS Method Data value.
 * @param container - the iframe container where the form will be attached to. The container must have the 'name'
 *                    attribute set
 * @throws {Error} - throws error if there is a validation error
 * @returns {HTMLIFrameElement} - the container
 */
nca3DSWebSDK.init3DSMethod = init3DSMethod;
 
/**
 * Initiates a 3DS Challenge request and submits the form the ACS URL.
 *
 * @param acsUrl - the FQDN URL to submit the Challenge Request
 * @param creqData - Base64-encoded Challenge Request
 * @param container - the iframe container where the form will be attached to. The container must have the 'name'
 *                    attribute set
 * @throws {Error} - throws error if there is a validation error
 * @returns {HTMLIFrameElement} - the container
 */
nca3DSWebSDK.init3DSChallengeRequest = init3DSChallengeRequest;
 
/**
 * Creates an iframe, attach it to the rootContainer and submits 3DS Challenge Request.
 * @param acsUrl - the FQDN URL to submit the Challenge Request
 * @param creqData - Base64-encoded Challenge Request
 * @param challengeWindowSize - EMVCo assigned window size.
 *                              '01' -> 250px x 400px,
 *                              '02' -> 390px x 400px,
 *                              '03' -> 500px x 600px,
 *                              '04' -> 600px x 400px,
 *                              '05' -> Full screen, or full container content
 * @param frameName - name of the frame container. if not set it will be set to 'threeDSCReqIFrame'
 * @param rootContainer - the container where the iframe will be attached to.
 *                        If not set defaults to the JavaScript document.body object
 * @param onFrameLoadCallback - callback function attached to the iframe.onload event
 * @param timeoutSeconds - timeout in seconds (default: 0 = no timeout)
 * @param onFrameTimeoutCallback - callback function called when timeout occurs
 * @throws {Error} - throws error if there is a validation error
 * @returns {HTMLIFrameElement} - returns the generated iframe element
 */
nca3DSWebSDK.createIFrameAndInit3DSChallengeRequest = createIFrameAndInit3DSChallengeRequest;
 
 
/**
 * Collects browser-specific data.
 *
 * @returns {Object} An object containing various properties about the user's browser and device.
 * @property {boolean} browserJavaEnabled - Whether Java is enabled in the browser.
 * @property {boolean} browserJavascriptEnabled - Always true; indicates JavaScript is functioning.
 * @property {string} browserLanguage - The browser's preferred language setting (e.g., 'en-US').
 * @property {number} browserColorDepth - Screen color depth in bits per pixel.
 * @property {number} browserScreenHeight - Total height of the screen in pixels.
 * @property {number} browserScreenWidth - Total width of the screen in pixels.
 * @property {string} browserTZ - Time zone of the browser in IANA format (e.g., 'America/New_York').
 * @property {string} browserUserAgent - The full User-Agent string of the browser.
 */
nca3DSWebSDK.getBrowserData = getBrowserData;
window.nca3DSWebSDK = nca3DSWebSDK;