> 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/https-coda-payments.gitbook.io-zhong-wen-coda-private-technical-documentation/codapay/hou-duan-api-ji-cheng/direct-card-api-ji-cheng/chu-li-3ds-yan-zheng.md).

# 处理 3DS 验证

当您提交扣款请求后，若收到的响应中包含 `"status_code": "waiting_for_shopper_action"`，请按照以下步骤处理 3DS 流程：

1. **准备挑战页面**：包含以下字段的 HTML 表单：
   * `challenge_jwt`
   * `challenge_md`
2. **自动提交表单**：将该表单自动提交至 `challenge_url` 接口。
3. **客户完成验证**：客户在挑战页面上完成 3DS 验证后，支付请求将提交进行身份认证。

以下是一个嵌入 iframe 的 3DS 验证示例：

```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';

    // 创建并添加 input 元素到表单中
    form.inputs.forEach(inputData => {
        const input = document.createElement('input');
        input.type = inputData.type;
        input.name = inputData.name;
        input.value = inputData.value;
        formElement.appendChild(input);
    });

    // 将表单添加到 body 中
    document.getElementsByTagName('body')[0].appendChild(formElement);

    // 自动提交表单
    formElement.submit();
  }

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

```

**类型：重定向**

提交付款后，如果您收到“status\_code”为“waiting\_for\_shopper\_action”且“type”为“redirection”的响应，您可以按照以下步骤处理重定向类型的 3DS 验证：

* 从 shopper\_action.redirection 对象中提取 URL。
* 使用指定方法（GET）将客户重定向到此 URL。
* 顾客在跳转后的页面上完成 3DS 验证。
* 完成后，客户将被重定向回您的返回 URL 并查看结果。


---

# 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 dynamically by asking a question.

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

```
GET https://docs.coda.co/https-coda-payments.gitbook.io-zhong-wen-coda-private-technical-documentation/codapay/hou-duan-api-ji-cheng/direct-card-api-ji-cheng/chu-li-3ds-yan-zheng.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
