> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cleariflow.com/llms.txt
> Use this file to discover all available pages before exploring further.

# VAT計算エンドポイント

> `calculate`エンドポイントは、国別の規制、取引金額、オプションの商品カテゴリを考慮した、コンプライアンスに準拠した正確なVAT計算を可能にします。

## はじめに

### ベースURL

```
https://vat.cleariflow.com/v1/calculate/
```

### 計算エンドポイント

`calculate`エンドポイントには、固有のAPIキー、国、確認したい価格が必要です。

```
https://vat.cleariflow.com/v1/calculate/
? api_key = YOUR_UNIQUE_API_KEY
& amount = 175  
& country_code = DE
& category = standard
```

この成功したリクエストは、税率、金額、国情報を含む包括的なVAT計算結果を返します。

<ResponseExample>
  ```json theme={"system"}
  {
      "amount_excluding_vat": "175.00",
      "amount_including_vat": "208.25",
      "country": {
          "code": "DE",
          "name": "Germany"
      },
      "vat_amount": "33.25",
      "vat_category": "standard",
      "vat_rate": "0.190"
  }
  ```
</ResponseExample>

### リクエストパラメータ

<ParamField query="api_key" type="String" required>
  固有のAPIキーです。各ユーザーはCleariflowの各APIごとに固有のAPIキーを持っているため、VAT検証APIのキーはIPジオロケーションAPIなどでは動作しません。
</ParamField>

<ParamField query="amount" type="String" required>
  VAT額を取得、またはVATを含む金額から逆算したい金額です。
</ParamField>

<ParamField query="country_code" type="String" required>
  取引が行われる国の2文字ISO 3166-1 alpha-2コードです。
</ParamField>

<ParamField query="category" type="String" required>
  計算に使用するVATカテゴリです。標準VAT税率には「standard」を使用し、「e-books」「audiobooks」などの特定カテゴリでは軽減税率が適用されます。
</ParamField>

<ParamField query="is_vat_incl" type="Boolean">
  金額にすでにVATが含まれており、逆算して金額とVATを分離したい場合は、このパラメータを true に設定してください。明示的に含めない場合、デフォルトは false です。
</ParamField>

### レスポンスパラメータ

APIレスポンスは、汎用的で軽量な [JSON形式](https://www.json.org/json-en.html) で返されます。

<ResponseField name="amount_excluding_vat" type="String">
  VATを除いた金額です。
</ResponseField>

<ResponseField name="amount_including_vat" type="String">
  基本金額とVATの合計、すなわち `amount_excluding_vat` + `vat_amount` です。
</ResponseField>

<ResponseField name="vat_amount" type="String">
  計算されたVAT額です。
</ResponseField>

<ResponseField name="vat_category" type="String">
  購入のカテゴリで、軽減税率の対象となるかどうかを判定するために使用されます。サポートされているカテゴリのリストは以下を参照してください。
</ResponseField>

<ResponseField name="vat_rate" type="String">
  小数文字列としてのVAT税率です（例：19%の場合は「0.190」）。
</ResponseField>

<ResponseField name="country" type="Object">
  国情報を含むオブジェクトです。
</ResponseField>

<ResponseField name="country.code" type="String">
  取引が行われる国の2文字ISO 3166-1 alpha-2コードです。
</ResponseField>

<ResponseField name="country.name" type="String">
  VATが計算される国の名前です。
</ResponseField>
