> 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/tokenization-api-2.0/webhooks-tong-zhi.md).

# Webhooks 通知

我们将通过 **POST 请求** 将 **实时事件数据** 发送到您的应用程序端点，并以 **Event JSON Payload** 的形式传递数据。

例如：

* 当 **Token 生成** 时，您将收到 **`token.status.authorized`** 事件，并创建 **Token 对象** 数据。
* 当 **Charge 成功** 时，您将收到 **`charge.succeeded`** 事件，并创建 **Charge 对象** 数据。

## **Webhook 安全性（Webhook Security）**

* 我们对 **Webhook 请求** 实施了 **安全层**，并使用 **事件 ID（Event ID）** 作为 **幂等键（Idempotency Key）**，以防止重复的 Webhook 请求。
* **任何超过 15 分钟的 Webhook 请求**，合作伙伴应**拒绝处理**，以降低潜在的安全风险。
* Coda 将提供 **Webhook 请求的 IP 白名单**，以确保安全访问。

<table><thead><tr><th width="244">请求标头 (Header)</th><th>描述</th></tr></thead><tbody><tr><td>X-Request-Time</td><td>此请求头包含 UTC 格式的时间戳，指示发送 Webhook 请求的时间。</td></tr><tr><td>X-Signature</td><td>此请求头涉及 HMAC 512 算法</td></tr><tr><td>X-Version</td><td>该请求头包含版本号</td></tr></tbody></table>

## **签名生成**

以下代码示例用于 **生成签名**。该示例使用 **Apache Commons Codec Library**，该库提供了 **HMAC 算法** 的实现。

签名的生成过程与 **请求时间（Request Time）** 和 **请求体（Request Body）** 紧密相关。

{% tabs %}
{% tab title="Java" %}

```javascript
public String generateSignature(@Nonull String requestTime, @Nonull String requestBody, @Nonull String signingSecret) {
      // Construct signature message 
String message = String.format("%s.%s", requestTime, requestBody);
// using commons-codec:commons-codec:1.16.0 library 
return new HmacUtils("HmacSHA512", signingSecret).hmacHex(message); 
}
```

{% endtab %}
{% endtabs %}

## Coda IP 地址

* 沙盒环境: 18.136.53.162
* 正式环境: 18.142.81.115, 18.139.237.164, 52.76.210.89


---

# 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/tokenization-api-2.0/webhooks-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.
