> 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/ji-suan-shui-fei.md).

# 计算税费

## **前置条件**

在接入 Codapay 的 API 时，请确保遵循以下规范：

* 使用 HTTPS 协议
* 使用 TLS 1.2 或更高版本

## **参考信息**

<table><thead><tr><th width="170.54083251953125">环境</th><th>接口基本网址</th></tr></thead><tbody><tr><td>沙盒环境</td><td><a href="https://tc-api-card-sandbox.codapayments.com/v1/">https://tc-api-card-sandbox.codapayments.com/v1/</a></td></tr><tr><td>正式环境</td><td><a href="https://api-tc.codapayments.com/v1/">https://api-tc.codapayments.com/v1/</a></td></tr></tbody></table>

#### **接口：**

<mark style="color:green;">**POST**</mark>**&#x20;{基本网址}/tax-calculations**

**当前环境可用性：**

| 环境   | 是否可用 |
| ---- | ---- |
| 沙盒环境 | 是    |
| 正式环境 | 是    |

> Codapay 的 API 支持 REST 网页服务。默认情况下，显示的端点均为 RESTful 格式。

## **请求参数说明**

<table><thead><tr><th>参数名称</th><th width="102.10760498046875">数据类型</th><th>描述</th><th>限制条件</th><th>必填 (?)</th></tr></thead><tbody><tr><td>amount_value</td><td>Integer</td><td>扣款金额</td><td>无</td><td>是</td></tr><tr><td>amount_currency</td><td>String</td><td>扣款币种</td><td>仅限指定国家的币种</td><td>是</td></tr><tr><td>country_code</td><td>String</td><td>用于计算税费的国家代码</td><td>必须为有效的 ISO 3166-1 alpha-2 国家代码</td><td>是</td></tr><tr><td>tax_code</td><td>String</td><td>商品的税码</td><td>当前支持的税码：CD010001 - 数字商品：游戏 / 串流 / 电子下载</td><td>是</td></tr><tr><td>address</td><td>JSON 对象</td><td>用于税费计算的邮政编码信息</td><td>当 country_code 为 US 或 CA 时必填</td><td>否</td></tr><tr><td>is_exclusive</td><td>Boolean</td><td>是否为未含税金额，默认为未含税</td><td>无</td><td>否</td></tr></tbody></table>

#### **address**&#x20;

| 参数名称           | 数据类型   | 描述                 | 限制条件         | 必填 (?) |
| -------------- | ------ | ------------------ | ------------ | ------ |
| zip\_code      | String | 用于计算税费的邮政编码        | 必须为有效的邮政编码   | 否      |
| province\_code | String | 用于计算税费的省份代码（仅限加拿大） | 必须为两位字母的省份代码 | 否      |

## **响应参数说明**

<table><thead><tr><th width="204.9383544921875">参数名称</th><th width="153.904541015625">数据类型</th><th>描述</th></tr></thead><tbody><tr><td>id</td><td>String</td><td>税费计算的唯一标识符</td></tr><tr><td>amount_value</td><td>Integer</td><td>扣款金额</td></tr><tr><td>amount_currency</td><td>String</td><td>扣款币种</td></tr><tr><td>country_code</td><td>String</td><td>用于税费计算的国家代码</td></tr><tr><td>tax_code</td><td>String</td><td>用于税费计算的税码</td></tr><tr><td>address</td><td>JSON 对象</td><td>用于税费计算的地址详情</td></tr><tr><td>is_exclusive</td><td>Boolean</td><td>表示发送的金额是否为未含税，默认认为是未含税</td></tr><tr><td>calculation</td><td>JSON 对象</td><td>税费计算的结果</td></tr><tr><td>status_code</td><td>String</td><td>税费计算的状态码</td></tr></tbody></table>

#### **address**&#x20;

| 参数名称      | 数据类型   | 描述          |
| --------- | ------ | ----------- |
| zip\_code | String | 用于税费计算的邮政编码 |

#### **calculation**&#x20;

| 参数名称            | 数据类型   | 描述         |
| --------------- | ------ | ---------- |
| taxable\_amount | String | 应税金额       |
| tax\_amount     | String | 计算出的税额     |
| total\_amount   | String | 应税金额与税额的总和 |
| tax\_rate       | String | 所应用的税率     |


---

# 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/ji-suan-shui-fei.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.
