> 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/hou-duan-fei-ka-pian-api-ji-cheng/cheng-gong-jiao-yi-hui-tiao-tong-zhi.md).

# 成功交易回调通知

在支付流程中，订单交易状态将是以下之一：

* 处理中 (Pending)
* 成功 (Successful)&#x20;
* 失败 (Failed)

每当订单交易被更新为“成功”或“失败”时，您将通过在Coda后台中配置的回调URL(Complete Notification URL)收到通知。<br>

## 前提条件

在Coda后台中配置了**回调URL(Complete Notification URL)**。请参阅[开始支付渠道设置](/https-coda-payments.gitbook.io-zhong-wen-coda-private-technical-documentation/codapay/codapay-ru-men-zhi-nan/kai-shi-zhi-fu-qu-dao-she-zhi.md)以获取详细指导，后台更改会即时更新。

{% hint style="success" %}
这是一个 Web 应用程序 URL，使用 **HTTP/1.1 -&#x20;**<mark style="color:green;">**GET**</mark>**&#x20;方法**，并包含以下 HTTP 参数。
{% endhint %}

## 回调参数

回调将发送到您在Coda后台中配置的回调URL，并附加以下查询参数。

<table><thead><tr><th width="155">参数</th><th>描述</th></tr></thead><tbody><tr><td>TxnId</td><td><strong>必填</strong><br>您在发起支付后收集到的Coda订单ID</td></tr><tr><td>OrderId</td><td><strong>必填</strong><br>您在支付请求发起时传递的订单ID</td></tr><tr><td>ResultCode</td><td><p><strong>必填</strong><br>ResultCode将帮助指示交易的状态。</p><p><code>ResultCode = 0</code> 表示交易成功。</p><p><code>ResultCode = 431 481 或 216</code> 表示交易待处理</p><p>所有其他ResultCode值表示交易失败。您可以在<a href="https://coda-payments.gitbook.io/zhong-wen-coda-private-technical-documentation/codapay/can-kao-zi-liao/chang-jian-cuo-wu-dai-ma">这里</a>找到完整的错误代码及其解释。</p></td></tr><tr><td>TotalPrice</td><td><strong>必填</strong><br>用户为订单交易支付的总金额。此金额将始终以本地货币计算。</td></tr><tr><td>PaymentType</td><td><strong>必填</strong><br>客户选择的支付类型。<br>PaymentType等于支付渠道ID，或者当支付渠道为运营商计费时，等于1。</td></tr><tr><td>Checksum</td><td><strong>必填</strong><br>校验帮助验证消息是否由 Codapay 发送，并确保消息未被篡改。有关如何使用此参数的更多信息，请参阅<a href="/pages/vilOzcm8mySaXwzmWIPn">安全指南</a>。</td></tr><tr><td>USDPrice</td><td><p><strong>可选</strong><br>如果在美元不是当地货币的国家发起交易，Coda 回调参数（TotalPrice）将默认显示用户的当地货币金额。</p><p>如果您需要在回调中添加最初的 USDPrice，请在Coda后台中进行配置。有关更多详情，请参阅<a href="/pages/F1nvWNA0LsDhzX7zjmaM">USD 订单交易概览</a>。</p></td></tr></tbody></table>

## 预期响应

❗️**商家在收到Coda订单回调成功支付通知后，并成功发货后需回复"ResultCode=0"（字符串）**

示例：

`NotifyURL="商家回调地址TxnId=Coda订单号&OrderId=商家orderID&TotalPrice=金额&PaymentType=渠道号&ResultCode=0&Checksum=xxxxx", MResp="ResultCode=0"`

❗️**若 Coda 未收到 `ResultCode=0` 的回复，将启动重试机制：**

* 系统会每隔 5 分钟重试一次，总共重试 3 次。
* 若重试机制失败，将通过邮件通知商家。

## 示例

{% tabs %}
{% tab title="v2.0 回调" %}

```javascript
//Sample for non-USD payments initiated
https://mynotificationurl.com?TxnId=6939780507541591264&OrderId=20230906052730&TotalPrice=1000.00&PaymentType=1&ResultCode=0&Checksum=xxxxxxx&MnoId=23&Msisdn=81800000001&PayCurrency=IDR&PayAmount=1000.0&OriginAmount=1000.0&OriginCurrency=IDR

//Sample for USD payments initiated
https://mynotificationurl.com?TxnId=6934776667511598376&OrderId=20230831102746&TotalPrice=15202.00&PaymentType=1&ResultCode=0&Checksum=xxxxxxx&MnoId=23&Msisdn=81800000001&PayCurrency=IDR&PayAmount=15202.0&OriginAmount=1.0&OriginCurrency=USD
```

{% endtab %}

{% tab title="v1.0 回调" %}

```python
https://mynotificationurl.com?TxnId=7178589013775074766&OrderId=12321312321314&TotalPrice=100&PaymentType=101&resultDesc=Success&ResultCode=0&Checksum=xxxxxxx
```

{% endtab %}

{% tab title="响应" %}

```json
"ResultCode=0" //必须作为字符串返回
```

{% endtab %}
{% endtabs %}

***

## 订单状态双重验证

{% hint style="warning" %}
**我们强烈建议商家使用** [**InquiryPaymentResult API**](/https-coda-payments.gitbook.io-zhong-wen-coda-private-technical-documentation/codapay/zhi-fu-ye-mian-api-ji-cheng/cha-xun-ding-dan-jie-kou.md) **做双重确认 (回调通知 + 订单状态结果成功), 以确保订单成功后才发货**
{% endhint %}


---

# 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/hou-duan-fei-ka-pian-api-ji-cheng/cheng-gong-jiao-yi-hui-tiao-tong-zhi.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.
