> 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/direct-card-api-diao-yong-liu-cheng.md).

# Direct Card API 调用流程

<figure><img src="/files/a5n2vdIaxIurwrn1q2oM" alt=""><figcaption><p>Direct Card API 调用流程</p></figcaption></figure>

1. 用户在准备购买时会跳转至结账页面。
2. 用户输入卡片信息并提交。提交后，调用 [`/direct/charges` 接口](/https-coda-payments.gitbook.io-zhong-wen-coda-private-technical-documentation/codapay/hou-duan-api-ji-cheng/direct-card-api-ji-cheng/ti-jiao-kou-kuan-qing-qiu.md)通过 vault proxy 发起支付请求。该请求会返回一个 charge 对象，其中包含与 3DS 相关的下一步操作详情。charge 对象作为支付请求的完整记录，在整个结账过程中跟踪支付状态等详细信息。在调用 `/direct/charges` 接口后，若请求未成功，支付状态将为 processing（处理中）或 failed（失败）。
3. 使用 charge.shopper\_action 对象中的 URL 和参数启动 3DS 流程，并向用户显示 3DS 页面以完成授权。如果无需授权，则跳过此步骤。
4. 授权步骤完成后，系统将通过[授权通知](/https-coda-payments.gitbook.io-zhong-wen-coda-private-technical-documentation/codapay/hou-duan-api-ji-cheng/direct-card-api-ji-cheng/huo-qu-kou-kuan-zhuang-tai-bian-geng-tong-zhi.md)发送结果。如果授权成功，将进行欺诈风险检查，支付状态将更新为 authorized（已授权）。如果授权失败，将在授权通知中收到错误信息，支付状态将为 failed（失败）。
5. 如果授权和风险检查都成功，且你在调用 `/direct/charges` 接口时提供了 `pre_capture_ack_url` 参数，则会收到一个扣款确认请求，用于决定是否继续执行扣款操作。如果你同意继续，支付将被扣款；否则交易将被取消。
6. 扣款成功后，你将收到相应的通知。请注意，扣款成功通知可能会有几分钟的延迟。此时，支付状态将更新为 captured（已扣款）。
7. 期间，你可通过调用[交易状态查询接口](/https-coda-payments.gitbook.io-zhong-wen-coda-private-technical-documentation/codapay/hou-duan-api-ji-cheng/direct-card-api-ji-cheng/huo-qu-kou-kuan-zhuang-tai-bian-geng-tong-zhi.md)检查交易状态，该接口将返回当前的 charge 对象状态。


---

# 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/direct-card-api-diao-yong-liu-cheng.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.
