# Basic 3DS Instructions

{% hint style="info" %}
You can test the 3DS process flow by using [test cards](/konnektive-crm/admin-setup/test-cards.md).
{% endhint %}

The 3D-Secure process involves sending the consumer to a url or executing a script for the consumer’s bank. The consumer must enter additional security information to authenticate identity. 3DS is a more complicated transaction flow than the standard Import Order and Upsell API calls. The benefit is a secure checkout and a liability shift for chargebacks due to fraud.

To begin the 3DS process flow, first send the standard Order Import or Upsell request. Not all cards are 3DS enabled and will simply process through the normal way. If the issuing bank requires a 3DS authentication then the response will indicate that. Your page must take additional action to process the sale.

{% hint style="info" %}
3DS requires that redirectsTo and errorRedirectsTo be included on Order Import and Upsell requests.

* redirectsTo = the url where the browser should redirect on a successful transaction
* errorRedirectsTo = the url where the browser should redirect on a failed transaction
  {% endhint %}

Konnektive has two different 3DS response types:

**1. 3DS redirect URL response**

This response indicates that the user's browser should be redirected to a specific URL

```
{
    "result": "MERC_REDIRECT",
    "message": {
        "url": "https://redirecttheuserhere.com"
    }
}
```

**2. 3DS JavaScript response**

This response indicates that the user's browser should execute the supplied JavaScript. [The JS eval function can be used for this](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval)

```
{
    "result": "MERC_REDIRECT",
    "message": {
        "script": "var iframe=document.createElement(\\'IFRAME\\');iframe.innerHTML=..."
    }
}
```

&#x20;

**3. Example script to handle both responses**

```
if (result === "MERC_REDIRECT") {
    if (message && message.url) {
        window.location.href = message.url;
    } else if (message && message.script) {
        eval(message.script);
    }
}
```

&#x20;

On completion of the 3DS process, one of 2 events will occur:

**1. 3DS FAILURE**

On failure, the consumer will be redirected back to the URL provided in the **errorRedirectsTo** parameter. Additionally, the **errorMsg** parameter will be sent as part of the URL query string \
Ex. GET [https://mysalesPage.com/lander/index.php?errorMsg=Description+of+bank+error](https://mysalespage.com/lander/index.php?errorMsg=Description+of+bank+error)

**2. 3DS SUCCESS**

On success, the browser will initiate a POST request to the URL provided in the **redirectsTo** parameter. The request will contain two POST parameters:\
finalizeTransaction=1\&orderData={}, which contains the same json-encoded response information as a successful non-3DS Import Order request.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.konnektive.com/konnektive-crm/gateway-setup/basic-3ds-instructions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
