Client-Side Integration (Non-iFields)
This is the Non-iFields Client-Side Integration document for 3D Secure 2.0.
For the iFields client-side 3DS 2.0 integration, refer to iFields
Configuration Properties
The javascript object exposes the following properties:
Property | Description | Allowed Values/Comments |
configuration.enableConsoleLogging | Can be set by the user to turn console logging on for debugging purposes or off to remove extra console writes. Defaults to true. | true/false |
configuration.onVerifyComplete | Should be set by the user - this is a function handler that will be called when a challenge (step-up) is completed (see below for sample function) | name of your javascript function that will handle the transaction completion |
referenceId | Set by the internal code, this property will contain the 3DS reference id for the current transaction | Passed to gateway as part of transaction |
initializeStatus | Set by the internal code, this property will contain the status of initialization | Passed to gateway as part of transaction |
error | Set by the internal code, this will contain any error information relevant to the 3DS process | Passed to gateway as part of transaction |
Methods
Method name | Description | Parameters |
initialize3DS | To be called on the page load, to set up the environment for processing a 3DS authentication transaction | threeDSEnvironment - string - set to either “prod” or “staging” |
profileBin | To be called before submitting the initial transaction | bin - 9 digit card bin |
verifyTrans | To be called if the initial transaction response status is “V”, indicating that a challenge/step-up is required for authentication | A javascript object with the following values from the Cardknox gateway response: {xRefNum, xVerifyURL, xVerifyPayload, xInternalID } |
Implementation Steps
Import the Library
Add two JS file references to your web page in your page header:
Create JavaScript handler for verification
When a 3DS 2.0 step-up authentication flow occurs, you must handle this by sending the verification results to the payment gateway. Create a JavaScript function on your page to do this. The ck3DS object will call this function automatically when a step-up verification completes. The function will receive the verification results as input parameters.
The order of parameters is as shown in the following code sample:
Configure the 3DS object
In your page load, add the initialization code:
Add 3DS profiling and submit results with the initial payment request
In the form submit handler, before submitting the payment, add the 3DS values to the data to be sent on to the gateway, using whatever submit mechanism is being used on your page. For example, the code below sets the hidden fields on the page to the corresponding values and then submits the form:
Handle 3DS Challenge
Modify the above code (line 15 in the sample snippet above) to correctly handle the server response. If the response from Cardknox had a status of V / Verify, call the verifyTrans
function. The parameters this function needs are returned as part of the gateway response object and should just be passed along:
When 3DS verification is complete, the onVerifyComplete
handler (created in step 2 and "hooked up" in step 3) will be called with the response fields that should be passed to your server.
Last updated