> For the complete documentation index, see [llms.txt](https://docs.coda.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coda.co/codapay/direct-api-integration/direct-api-integration-for-cards/handling-3ds.md).

# Handling 3DS

Handle charges that require 3DS authentication from customers.

After submitting a charge, if you receive a response with "status\_code": "waiting\_for\_shopper\_action" , you may follow these steps to handle the 3DS challenge:

* Include a challenge page with the challenge\_jwt and the challenge\_md.
* Automatically submit this form to the challenge\_url endpoint,
* The customer completes the challenge page. The payment request is then submitted for authentication.<br>

Example 3DS challenge inside an iframe:

```javascript
<body>
       ....
<iframe id="iframe-name" height="250" width="400"></iframe>
       ....

<script>
  ....
  function onShopperActionForm(form) {
    const formElement = document.createElement('form');
    formElement.method = form.method;
    formElement.action = form.action;
    formElement.target = 'iframe-name';

    // Create and append input elements to the form
    form.inputs.forEach(inputData => {
        const input = document.createElement('input');
        input.type = inputData.type;
        input.name = inputData.name;
        input.value = inputData.value;
        formElement.appendChild(input);
    });

    // Append the form to the body
    document.getElementsByTagName('body')[0].appendChild(formElement);

    // Automatically submit the form
    formElement.submit();
  }

         ....
       
</script>
</body>

```

#### Type: Redirection

After submitting a charge, if you receive a response with "status\_code":"waiting\_for\_shopper\_action" and "type": "redirection", you may follow these steps to handle the 3DS challenge for redirection type:

* Extract the url from the shopper\_action.redirection object.
* Redirect the customer to this URL using the specified method (GET).
* The customer completes the 3DS challenge on the redirected page.
* After completion, the customer is redirected back to your return URL with the result.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.coda.co/codapay/direct-api-integration/direct-api-integration-for-cards/handling-3ds.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
