This step is only required if the response from the 3DS Auth API (Step 3) indicates the challengeRequired
property is true
. Inside this response will be another redirectUrl
property.
There are two possible flowsoptions:
Use an ACS challenge iframe
Full Perform a full browser redirect to ACS challenge page (If a
merchantRedirectUrl
was provided in the 3DS Init Call in Step 1)
Option 1: Use an ACS challenge iframe
If a merchantRedirectUrl was not supplied, create an iframe to contain the ACS challenge.
...
The default size of the challenge iframe will be full screen. However, if the acsWindowSize
property was specified in the 3DS init call (Step One1), then the iframe must have the same width and height as the acsWindowSize provided.
...
Create a POST message event Listener
The merchant site needs to know when the challenge is complete, and can proceed to call the 3DS Result. API. This done via a window.postMessage from the iframe.
Create an event listener on the page to receive this event. For security purposes, be sure to check the origin of the message is from the Netvalve domain.
Code Block |
---|
const handlePostEvent = (event) => {
if (event.origin === 'https://gateway.uat.sandbox-netvalve.com') {
const data = event.data;
// Use the data to perform STEP 3
}
};
// Be sure to attach the listener
window.addEventListener('message', handlePostEvent, false);
|
Extract the message data
Inside the event.data
is the following object. The expected status is ACS_COMPLETED
Code Block |
---|
{
result: 'SUCCESS',
threeDsResponse: {
status: 'ACS_COMPLETED',
transID: 'abc,
providerErrorMessage: ''
};
}; |
Refer back to Step 2 for a description of each of these properties.
Once the message is received, whether success or fail, proceed to call the Result API in Step 5.
Option 2: Perform a full browser redirect
Instead of placing the redirectUrl
inside an iframe, the alternative is to perform a browser redirect to the Netvalve page, where the ACS challenge will be hosted.
Once the challenge is complete, the user will be redirected back to the merchant site.
The transID
can be extracted from the URL parameters, appended to the merchant’s url. This is what the URL might look like:
Code Block |
---|
https://merchantsite?result=SUCCESS&transID=6b65860e-a9ee-416d-b8a9-e6b674634470&threeDsStatus=ACS_COMPLETED |
Please note : A merchantRedirectUrl
must have been initially supplied in Step 1.