> 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/hui-tiao-tong-zhi-xiang-qing.md).

# 回调通知详情

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

* Pending（待处理）
* Successful（成功）
* Failed（失败）

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

## 前置条件 <a href="#qian-zhi-tiao-jian" id="qian-zhi-tiao-jian"></a>

在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) 以获取详细指导，后台更改会即时更新。

## 回调参数

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

<table><thead><tr><th width="209">参数</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>*OriginAmount</td><td><p><strong>*此字段仅在 v2.0 API 版本中，根据特殊请求返回</strong></p><p><strong>可选</strong></p><p>在发起请求时提供的金额</p></td></tr><tr><td>*OriginCurrency</td><td><p><strong>*此字段仅在 v2.0 API 版本中，根据特殊请求返回</strong></p><p><strong>可选</strong> </p><p>ISO 4217 字母代码（如 USD、IDR 等）。在发起请求时用于指定商品价格的货币。</p><p>OriginCurrency可能与PayCurrency不同。</p></td></tr><tr><td>*PayAmount</td><td><p><strong>*此字段仅在 v2.0 API 版本中，根据特殊请求返回</strong></p><p><strong>可选</strong></p><p>以PayCurrency为单位计费给用户的最终价格。<br>注意：TotalPrice始终等于PayAmount。</p></td></tr><tr><td>*PayCurrency</td><td><p><strong>*此字段仅在 v2.0 API 版本中，根据特殊请求返回</strong></p><p><strong>可选</strong><br>ISO 4217字母代码（USD、IDR等）。用于实际支付并向用户收费的货币。</p></td></tr><tr><td>*SubTotalPrice</td><td><p><strong>*此字段仅在 v2.0 API 版本中，根据特殊请求返回</strong></p><p><strong>可选</strong></p><p>税前交易净金额。</p><p>计算方式为：totalPrice / (1 + payTaxRate)。该数值表示不包含当地服务费或数字税的商品基础价格。</p></td></tr><tr><td>*PayTaxRate</td><td><p><strong>*此字段仅在 v2.0 API 版本中，根据特殊请求返回</strong></p><p><strong>可选）</strong></p><p>该字段表示应用于该笔交易的税率百分比（例如：0.08 表示 8%）。该数值会根据商户配置、当地税收法规或用户的具体位置（邮政编码）动态确定。</p></td></tr><tr><td>resultDesc</td><td><p><strong>固定返回</strong></p><p><code>resultDesc</code> 参数用于帮助商户准确分析并处理交易失败的原因。</p><p>如果 <code>resultCode</code> 等于 0，<code>resultDesc</code> 将返回 “Success（成功）”。</p><p></p><p>如果 <code>resultCode</code> 表示错误，<code>resultDesc</code> 将提供该错误的详细描述。</p></td></tr><tr><td>ResultCode</td><td><p><strong>固定返回</strong><br>ResultCode将帮助指示交易的状态。</p><p></p><p><code>ResultCode = 0</code> 表示交易成功。</p><p><code>ResultCode = 431 481 或 216</code> 表示交易待处理</p><p></p><p>所有其他ResultCode值表示交易失败。您可以在 <a data-mention href="/pages/Ijfanb3Eb2mtXRsbF81n">/pages/Ijfanb3Eb2mtXRsbF81n</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>MnoId</td><td><p><strong>固定返回</strong></p><p>如果在支付渠道初始化过程中使用了need_mno_id参数，则此参数将包含支付渠道ID。</p></td></tr><tr><td>USDPrice</td><td><p><strong>固定返回</strong><br>如果在USD不是本地货币的国家发起交易，则Coda回调参数（TotalPrice）将默认显示用户的本地货币金额。</p><p></p><p>如果您需要在回调中添加初始的USDPrice，请联系Codapay技术团队。</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 次。
* 若重试机制失败，将通过邮件通知商家。

> 若要订阅交易通知，请前往 Publisher Portal：\
> **团队 > 管理访问权限 > 勾选“Transaction Notification” > 保存更改。**

***

## 示例

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

```javascript
// 当地货币请求示例
https://<your_webhook_url>?
  TxnId=7715121708032676249
  OrderId=365f5Z619951c1a4b8
  TotalPrice=1.00
  PaymentType=237
  ResultCode=0
  Checksum=6b6c5e0f835f9f1442726bed3aedc3c9
  PayTaxRate=8.00 //This field is only returned in v2.0 API
  PayCurrency=MYR //This field is only returned in v2.0 API
  PayAmount=1.00 //This field is only returned in v2.0 API
  OriginAmount=1.00 //This field is only returned in v2.0 API
  OriginCurrency=MYR //This field is only returned in v2.0 API
  SubTotalPrice=0.93 //This field is only returned in v2.0 API

// 美金请求示例
https://<your_webhook_url>?
  TxnId=7715122576202672831
  OrderId=365f5Z619951c1a4b8
  TotalPrice=1.17
  PaymentType=237
  ResultCode=0
  Checksum=10741fa6be7e6f2b189f029b3f8a0963
+ USDPrice=0.30
  PayTaxRate=8.00 //This field is only returned in v2.0 API
  PayCurrency=MYR //This field is only returned in v2.0 API
  PayAmount=1.17 //This field is only returned in v2.0 API
  OriginAmount=0.30 //This field is only returned in v2.0 API
  OriginCurrency=USD //This field is only returned in v2.0 API
  SubTotalPrice=1.08 //This field is only returned in v2.0 API
```

{% endtab %}

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

```javascript
// 当地货币请求示例
https://<your_webhook_url>?
  TxnId=7178589013775074766
  OrderId=12321312321314
  TotalPrice=100
  PaymentType=101
  ResultCode=0
  Checksum=e944d44f065eade8157737385a094a57
+ USDPrice=10.00

// 美金请求示例
https://<your_webhook_url>?
  TxnId=7178589013775038493
  OrderId=12321312321314
  TotalPrice=100
  PaymentType=101
  ResultCode=0
  Checksum=10741fa6be7e6f2b189f029b3f8a0963
```

{% endtab %}

{% tab title="响应" %}

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

{% endtab %}
{% endtabs %}

## 失败交易通知 <a href="#failed-transaction-notification" id="failed-transaction-notification"></a>

除了成功交易通知外，Codapay 还支持**失败交易通知。**

如果一笔交易未能达到成功状态，系统也会向已配置的“**交易完成通知 URL**”发送通知，其中包含相关的交易详情。

启用方式：失败交易通知**默认未开启**。如需启用此功能，请联系您的 Coda 客户经理或发送邮件至 <codapay_integration@coda.co> 联系集成支持团队。

#### 示例 <a href="#sample-1" id="sample-1"></a>

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

```javascript
// 失败交易示例
https://<your_webhook_url>?
  TxnId=7743322396792877759
  OrderId=20250611113402
  TotalPrice=2.00
  PaymentType=421
  ResultCode=750
  Checksum=ef631c0bef3249406cfe5c1350693195
  PayCurrency=MYR //This field is only returned in v2.0 API
  PayAmount=2.0 //This field is only returned in v2.0 API
  OriginAmount=2.0 //This field is only returned in v2.0 API
  OriginCurrency=MYR //This field is only returned in v2.0 API
```

{% endtab %}

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

```javascript
// 失败交易示例
https://<your_webhook_url>?
  TxnId=7743328618752877897
  OrderId=123
  TotalPrice=222222210.00
  PaymentType=237
  ResultCode=415
  Checksum=f3a06cf11a0244b0308c8d8acbf53add
  resultDesc=This transaction has been cancelled. No charges were made. (error:415)
```

{% 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/zhi-fu-ye-mian-api-ji-cheng/hui-tiao-tong-zhi-xiang-qing.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.
