> 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/zhi-fu-ye-mian-api-ji-cheng/fa-qi-usd-jiao-yi/qing-qiu-liu-cheng.md).

# 请求流程

## USD 交易发起的调用流程

<figure><img src="/files/dCxNCR4uke4foccdHX9f" alt=""><figcaption></figcaption></figure>

Codapay API 结构 **无变更**，合作伙伴只需在 **Init 请求** 的 `"currency"` 参数中 **传递所需的 ISO 4217 货币代码**。

* **美元（USD）** 的 ISO 代码为 **840**。

#### **请求流程**

1. **合作伙伴发起请求**：如果需要以 **美元（USD）** 计价，`currency` 参数应设置为 **`840`**。
2. **Coda 付款页面转换货币**：当用户支付时，Coda 付款页面将 **转换并显示为本地货币**。
3. **基于每日汇率计算**：Coda 付款页面会依据 **当日 Coda 系统的汇率**，在本地货币中展示最终价格。

## 请求与响应示例

{% tabs %}
{% tab title="请求" %}

```json
{
    "initRequest":
    {
        "country": 360,
        "payType": 0,
        "apiKey": "<Your API Key>",
        "orderId": "1234",
        "currency": 840,
        "items":
        [
            {
                "code": "1",
                "price": 100.00,
                "name": "Test Item 500"
            }
        ],
        "profile":
        {
            "entry":
            [
                {
                    "key": "user_id",
                    "value": "105"
                }
            ]
        }
    }
}
```

{% endtab %}

{% tab title="成功响应示例" %}

```json
{
    "initResult": {
        "resultCode": 0,
        "txnId": 7177415887085060516
    }
}
```

{% endtab %}

{% tab title="失败响应示例" %}

```json
{
    "initResult": {
        "resultCode": 103,
        "resultDesc": "This transaction has been cancelled. No charges were made. (error:103)",
        "txnId": 0
    }
}
```

{% endtab %}
{% endtabs %}

以上是一个示例，使用 **Coda 的渠道选择页面（paytype=0）** 进行支付。在请求打开支付页面后，用户将看到 **可选的支付渠道**，并同时显示 **相应的本地货币价格**。


---

# 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/zhi-fu-ye-mian-api-ji-cheng/fa-qi-usd-jiao-yi/qing-qiu-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.
