> 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/codapay/direct-api-integration/direct-api-integration-for-cards/calculate-tax.md).

# Calculate tax

### Pre-requisite

When integrating with Codapay's API, ensure you adhere to the following standards:

1. Use HTTPS protocol.
2. TLS 1.2 or higher

### Reference

<table><thead><tr><th width="180">Environment</th><th>Endpoint Base URL</th></tr></thead><tbody><tr><td>Sandbox</td><td><a href="https://tc-api-card-sandbox.codapayments.com/v1/direct/charges">https://tc-api-card-sandbox.codapayments.com/v1/</a></td></tr><tr><td>Production</td><td><a href="https://api-tc.codapayments.com/v1/direct/charges">https://api-tc.codapayments.com/v1/</a></td></tr></tbody></table>

#### Endpoint

<mark style="color:green;">**POST**</mark>**&#x20;{Base URL}/tax-calculations**

#### Current Environment Availability

<table><thead><tr><th width="227">Environment</th><th>Is Available?</th></tr></thead><tbody><tr><td>Sandbox</td><td>Yes</td></tr><tr><td>Production</td><td>Yes</td></tr></tbody></table>

{% hint style="info" %}
Codapay's APIs support REST web services. By default, the endpoints displayed are RESTful.&#x20;
{% endhint %}

### Request Parameters

| Parameter Name   | Data Type   | Description                                                                                                               | Constraint                                                                                                          | Is Required? |
| ---------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------ |
| amount\_value    | Integer     | The amount value of the charge                                                                                            | <p><br></p>                                                                                                         | Yes          |
| amount\_currency | String      | The currency of the charge                                                                                                | Only the currency of the specified country                                                                          | Yes          |
| country\_code    | String      | The country code for tax calculation                                                                                      | Must be a valid ISO 3166-1 alpha-2 country code                                                                     | Yes          |
| tax\_code        | String      | The tax code of the product                                                                                               | <p>Currently the supported tax codes are </p><p>CD010001 - Digital goods: Games-Streaming / electronic download</p> | Yes          |
| address          | JSON Object | <p>The zip code details used for tax calculation.<br><br>Required when country\_code = US or CA</p>                       | <p><br></p>                                                                                                         | No           |
| is\_exclusive    | Boolean     | Whether the amount sent is exclusive of tax or not. It is by default considered that the amount sent is exclusive of tax. | <p><br></p>                                                                                                         | No           |

**address**

| Parameter Name | Data Type | Description                                | Constraint                                           | Is Required? |
| -------------- | --------- | ------------------------------------------ | ---------------------------------------------------- | ------------ |
| zip\_code      | String    | The ZIP code used for tax calculation      | Must be a valid zip code                             | No           |
| province\_code | String    | The province code used for tax calculation | Two letter province code . Only supported for Canada | No           |

### Response Parameters

Samples can be found <mark style="color:purple;">here</mark>.

| Parameter Name   | Data Type   | Description                                                                                          |
| ---------------- | ----------- | ---------------------------------------------------------------------------------------------------- |
| id               | String      | Unique identifier for the tax calculation                                                            |
| amount\_value    | Integer     | The amount of the charge                                                                             |
| amount\_currency | String      | The currency of the charge                                                                           |
| country\_code    | String      | The country code for tax calculation                                                                 |
| tax\_code        | String      | The tax code used for tax calculation                                                                |
| address          | JSON Object | The address details used for tax calculation                                                         |
| is\_exclusive    | Boolean     | Indicates whether the amount sent is exclusive of tax. By default, it is considered exclusive of tax |
| calculation      | JSON Object | The result of tax calculation                                                                        |
| status\_code     | String      | The status code for tax calculation                                                                  |

\
**address**

| Parameter Name | Data Type | Description                           |
| -------------- | --------- | ------------------------------------- |
| zip\_code      | String    | The ZIP code used for tax calculation |

**calculation**

| Parameter Name  | Data Type | Description                                       |
| --------------- | --------- | ------------------------------------------------- |
| taxable\_amount | String    | The amount subject to tax                         |
| tax\_amount     | String    | The amount of tax calculated                      |
| total\_amount   | String    | The sum of the taxable amount and the tax amount. |
| tax\_rate       | String    | The rate of tax applied                           |


---

# 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/codapay/direct-api-integration/direct-api-integration-for-cards/calculate-tax.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.
