# 税金の徴収 Stripe Tax API を使用して、カスタムのシステムに税額計算を実装します。 Stripe Tax API を使用すると、カスタム決済フローで税金を計算できます。顧客が決済を完了した後で、取引を記録して Stripe Tax のレポートに表示されるようにします。このガイドの例では Stripe の Payment API を使用していますが、任意の決済代行業者や複数の決済代行業者で Tax API を使用することもできます。 カスタム決済フローが [Payment Intents API](https://docs.stripe.com/api/payment_intents.md) を使用している場合は、[カスタム決済フローでの税金計算](https://docs.stripe.com/tax/payment-intent.md)を参照してください。この連携機能は自動債務追跡、領収書、ダッシュボードに対応しています。また、[納税者番号 Element](https://docs.stripe.com/elements/tax-id-element.md) を使用して顧客から納税者番号を収集できる公開プレビュー機能もご提供しています。詳しくは、[顧客の納税者番号の収集](https://docs.stripe.com/tax/custom.md#collect-customer-tax-ids)をご覧ください。 あるいは、Stripe Tax を [Payment Links](https://docs.stripe.com/tax/payment-links.md)、[Checkout](https://docs.stripe.com/tax/checkout.md)、[Billing](https://docs.stripe.com/tax/subscriptions.md)、[Invoicing](https://docs.stripe.com/tax/invoicing.md) に導入することもできます。ローコードの設定です。 Tax API 導入の大まかな概要を示す図 (See full diagram at https://docs.stripe.com/tax/custom) この動画では、Payment Intents API と Payment Element を使用する Stripe Tax API の導入手順を説明しています。 [Watch on YouTube](https://www.youtube.com/watch?v=OfHJiC9Iek0) ## 登録を追加する Stripe Tax は、税金徴収の登録をしている管轄区域でのみ税金を計算します。ダッシュボードで [登録を追加](https://docs.stripe.com/tax/registering.md#add-a-registration) する必要があります。 ## Optional: 顧客住所を収集する [クライアント側] ほとんどの場合、回収する税金は顧客の場所によって決まります。顧客の住所全体を収集することで、税金の計算の正確性を確実に向上させることができます。住所の収集前に、[IP アドレス](https://docs.stripe.com/tax/custom.md#ip-address) に基づく見積もりを顧客に示すことができます。 > 以下の例では単純なカスタム住所フォームを使用していますが、[Address Element](https://docs.stripe.com/elements/address-element.md) を使用して、オートコンプリートやローカライゼーションの機能によって顧客から住所を収集することもできます。 以下のフォームにより、詳細な住所が収集されます。 ```html
``` サーバーエンドポイントに住所を渡すには、以下のようにします。 ```js const address = { line1: document.getElementById('address_line1').value, city: document.getElementById('address_city').value, state: document.getElementById('address_state').value, postal_code: document.getElementById('address_postal_code').value, country: document.getElementById('address_country').value, }; var response = fetch('/preview-cart', { method: 'POST', body: JSON.stringify({address: address}), headers: {'Content-Type': 'application/json'}, }).then(function(response) { return response.json(); }).then(function(responseJson) { // Handle errors, or display calculated tax to your customer. }); ``` 税金を計算するために必要な住所情報は、[顧客の国](https://docs.stripe.com/tax/customer-locations.md#supported-formats) によって異なります。 - **アメリカ**: 少なくとも顧客の郵便番号が必要です。最も正確な税金の計算結果を得るには、正確な住所を指定することをお勧めします。 - **カナダ**: 顧客の郵便番号または州が必要です。 - **その他の国**: 顧客の国コードのみが必要です。 ## 税額計算 [サーバー側] [課税](https://docs.stripe.com/api/tax/calculations/create.md) するタイミングと頻度を選択できます。たとえば、以下を実行できます。 - 顧客が決済フローに [顧客の IP アドレス](https://docs.stripe.com/tax/custom.md#ip-address) に基づく]税金の見積もりを表示する - 顧客が請求先住所または配送先住所を入力するときに税金を再計算する - 顧客が住所の入力を完了したときに、徴収する最終的な税額を計算する Stripe は課税する税金計算の API コールごとに[手数料を請求](https://stripe.com/tax/pricing)します。課税する税金計算の API コールを抑制して、コストを管理できます。 下記の例は、さまざまなシナリオで税金を計算する方法を示しています。Stripe Tax では、税金を徴収するために登録した管轄区域の税金のみを計算し、ダッシュボードで [登録を追加](https://docs.stripe.com/tax/registering.md#add-a-registration) する必要があります。 #### 例 - アメリカ: 外税商品 この例では、アメリカの配送先住所に課税される税金を計算します。ライン項目の価格は 10 USD で、アカウントの [事前設定の税コード](https://docs.stripe.com/tax/set-up.md#preset-tax-code) を使用しています。 ```curl curl https://api.stripe.com/v1/tax/calculations \ -u "<>:" \ -d currency=usd \ -d "line_items[0][amount]"=1000 \ -d "line_items[0][reference]"=L1 \ -d "customer_details[address][line1]"="920 5th Ave" \ -d "customer_details[address][city]"=Seattle \ -d "customer_details[address][state]"=WA \ -d "customer_details[address][postal_code]"=98104 \ -d "customer_details[address][country]"=US \ -d "customer_details[address_source]"=shipping ``` #### 例 - アメリカ: 配送料金を伴う複数の商品 この例には、複数の外税のラインアイテムと、5 USD の配送料金が含まれています。 ```curl curl https://api.stripe.com/v1/tax/calculations \ -u "<>:" \ -d currency=usd \ -d "line_items[0][amount]"=1000 \ -d "line_items[0][reference]"=L1 \ -d "line_items[0][tax_code]"=txcd_99999999 \ -d "line_items[1][amount]"=5000 \ -d "line_items[1][reference]"=L2 \ -d "line_items[1][tax_code]"=txcd_99999999 \ -d "line_items[2][amount]"=9999 \ -d "line_items[2][reference]"=L3 \ -d "line_items[2][tax_code]"=txcd_99999999 \ -d "shipping_cost[amount]"=500 \ -d "customer_details[address][line1]"="920 5th Ave" \ -d "customer_details[address][city]"=Seattle \ -d "customer_details[address][state]"=WA \ -d "customer_details[address][postal_code]"=98104 \ -d "customer_details[address][country]"=US \ -d "customer_details[address_source]"=shipping ``` #### 例 - アメリカ: 数量を含む商品 ニューヨークでは、衣料品の各アイテムの価格が 110 USD 未満の場合、売上税の対象にはなりません。この例には、合計価格が 150 USD で数量が 3 点の衣料品のライン項目が含まれています。衣料品の各アイテムの価格は 50 USD なので、売上税は非課税です。 ```curl curl https://api.stripe.com/v1/tax/calculations \ -u "<>:" \ -d currency=usd \ -d "line_items[0][amount]"=15000 \ -d "line_items[0][quantity]"=3 \ -d "line_items[0][reference]"=Clothing \ -d "line_items[0][tax_code]"=txcd_30011000 \ -d "shipping_cost[amount]"=500 \ -d "customer_details[address][state]"=NY \ -d "customer_details[address][postal_code]"=10001 \ -d "customer_details[address][country]"=US \ -d "customer_details[address_source]"=shipping ``` #### 例 - ヨーロッパ: 内税商品 この例では、通常は非事業の顧客に内税価格が使用される、アイルランドの請求先住所の税金を計算します。ラインアイテムの価格は 29.99 EUR で、税コードは `txcd_10302000` (電子書籍) です。 ```curl curl https://api.stripe.com/v1/tax/calculations \ -u "<>:" \ -d currency=eur \ -d "line_items[0][amount]"=2999 \ -d "line_items[0][reference]"=L1 \ -d "line_items[0][tax_behavior]"=inclusive \ -d "line_items[0][tax_code]"=txcd_10302000 \ -d "customer_details[address][country]"=IE \ -d "customer_details[address_source]"=billing ``` #### 例 - ヨーロッパ: 配送料金を伴う複数の商品 この例では、通常は非事業の顧客に内税価格が使用される、アイルランドの配送先住所の税金を計算します。配送される商品の価格は 59.99 EUR で、配送料は 5 EUR です。どちらの金額も内税になるので、顧客は常に 64.99 EUR を支払います。 ```curl curl https://api.stripe.com/v1/tax/calculations \ -u "<>:" \ -d currency=eur \ -d "line_items[0][amount]"=5999 \ -d "line_items[0][reference]"=L1 \ -d "line_items[0][tax_behavior]"=inclusive \ -d "line_items[0][tax_code]"=txcd_99999999 \ -d "shipping_cost[amount]"=500 \ -d "shipping_cost[tax_behavior]"=inclusive \ -d "customer_details[address][line1]"="123 Some House" \ -d "customer_details[address][city]"=Dublin \ -d "customer_details[address][country]"=IE \ -d "customer_details[address_source]"=shipping ``` #### 例 - 配送元住所 このベータ機能では、特定の州 (イリノイ州など) に配送元の住所を指定し、配送に物品が含まれている場合、配送元の住所に基づいて税金が徴収されます。配送に物品とサービスの両方が含まれている場合、配送元の住所に基づいて税金が両方に適用されます。 この例では、ビジネスの場所 (イリノイ州外) や配送先住所 (イリノイ州スプリングフィールド) ではなく、配送元住所 (イリノイ州ネイパービル) に基づいて税金を計算します。 ```curl curl https://api.stripe.com/v1/tax/calculations \ -u "<>:" \ -d currency=usd \ -d "line_items[0][amount]"=1000 \ -d "line_items[0][reference]"=L1 \ -d "line_items[0][tax_behavior]"=exclusive \ -d "line_items[0][tax_code]"=txcd_99999999 \ -d "shipping_cost[amount]"=500 \ -d "shipping_cost[tax_behavior]"=exclusive \ -d "customer_details[address][city]"=Springfield \ -d "customer_details[address][state]"=IL \ -d "customer_details[address][postal_code]"=62704 \ -d "customer_details[address][country]"=US \ -d "customer_details[address_source]"=billing \ -d "ship_from_details[address][city]"=Naperville \ -d "ship_from_details[address][state]"=IL \ -d "ship_from_details[address][postal_code]"=60540 \ -d "ship_from_details[address][country]"=US ``` [計算の応答](https://docs.stripe.com/api/tax/calculations/object.md) には、顧客に表示し、支払いを受けるのに使用できる金額が含まれます。 | 属性 | 説明 | | -------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | | [amount_total](https://docs.stripe.com/api/tax/calculations/object.md#tax_calculation_object-amount_total) | 課税した後の合計。顧客への支払いに PaymentIntent の[金額](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-amount) を設定します。 | | [tax_amount_exclusive](https://docs.stripe.com/api/tax/calculations/object.md#tax_calculation_object-tax_amount_exclusive) | ラインアイテムの金額と配送料金に追加される税金の金額。この税額は `amount_total` を増額します。これを使用して、取引の小計に追加される税額を顧客に示します。 | | [tax_amount_inclusive](https://docs.stripe.com/api/tax/calculations/object.md#tax_calculation_object-tax_amount_inclusive) | 項目の金額と配送料金に含まれている税金の金額 (内税価格を使用している場合)。この税額は `amount_total` を増額しません。これを使用して、決済金額の合計に含まれている税金を顧客に示します。 | | [tax_breakdown](https://docs.stripe.com/api/tax/calculations/object.md#tax_calculation_object-tax_breakdown) | 国や州の税率ごとに分類された税額のリスト。これを使用して、徴収している特定の税金を顧客に示します。 | ### 顧客の場所エラーの処理 顧客の住所が無効な場合や、税金の計算に使用できるほど精度が高くない場合は、計算で `customer_tax_location_invalid` エラーが返されます。 ```json { "error": { "doc_url": "https://docs.stripe.com/error-codes#customer-tax-location-invalid","code": "customer_tax_location_invalid", "message": "We could not determine the customer's tax location based on the provided customer address.", "param": "customer_details[address]", "type": "invalid_request_error" } } ``` このエラーを受け取った場合は、顧客に入力した住所を確認し、入力ミスを修正するように求めます。 ### 別の代行業者で計算を使用する Stripe 外で取引を処理する場合は、次の手順をスキップして、計算を外部で処理された取引に適用できます。 ## 税取引を作成する [サーバー側] 税取引を作成すると、顧客から徴収した税金が記録されるため、後でエクスポートをダウンロードして、[納税申告に役立つレポートを生成できます](https://docs.stripe.com/tax/reports.md)。作成から 90 日後の [expires_at](https://docs.stripe.com/api/tax/calculations/object.md#tax_calculation_object-expires_at) タイムスタンプまでの計算から[取引を作成できます](https://docs.stripe.com/api/tax/transactions/create_from_calculation.md)。この期間を過ぎてから使用しようとすると、エラーが返されます。 > 取引は `create_from_calculation` が呼び出された日付に有効であると見なされ、税額は再計算されません。 税取引を作成する際は、税取引とラインアイテムごとの一意の `reference` を指定する必要があります。この参照番号は、税金のエクスポート結果に表示され、徴収した税金をシステムの注文と照合するのに役立ちます。 たとえば、税取引の参照番号が `pi_123456789`、ラインアイテムの参照番号が `L1` と `L2`、配送料金がある場合、項目別の税金のエクスポートは次のようになります。 | ID | line_item_id | タイプ | 通貨 | transaction_date | | ------------ | ------------ | ---- | --- | ------------------- | | pi_123456789 | L1 | 外付けの | USD | 2023-02-23 17:01:16 | | pi_123456789 | L2 | 外付けの | USD | 2023-02-23 17:01:16 | | pi_123456789 | 配送 | 外付けの | USD | 2023-02-23 17:01:16 | 顧客が決済する際に、計算 ID を使用して徴収した税金を記録します。これを行うには 2 つの方法があります。 - 顧客が注文を送信するエンドポイントがサーバーにある場合は、注文が正常に送信された後で税取引を作成できます。 - [payment_intent.succeeded](https://docs.stripe.com/api/events/types.md#event_types-payment_intent.succeeded) Webhook イベントをリッスンします。PaymentIntent`メタデータ` から計算 ID を取得します。 以下の例では、取引を作成して、PaymentIntent ID を一意の参照番号として使用します。 ```curl curl https://api.stripe.com/v1/tax/transactions/create_from_calculation \ -u "<>:" \ -d calculation={{TAX_CALCULATION}} \ -d reference="{{PAYMENTINTENT_ID}}" \ -d "expand[]"=line_items ``` 後で返金を記録するために、[tax transaction ID](https://docs.stripe.com/api/tax/transactions/object.md#tax_transaction_object-id) を保存します。取引 ID は、データベースまたは PaymentIntent のメタデータに保存できます。 ```curl curl https://api.stripe.com/v1/payment_intents/{{PAYMENTINTENT_ID}} \ -u "<>:" \ -d "metadata[tax_transaction]"={{TAX_TRANSACTION}} ``` ## 返金を記録する [サーバー側] 顧客への売上を記録するために税取引を作成した後で、返金の記録が必要になる場合があります。これらは、`type=reversal` の税取引としても表されます。差戻し取引は、逆の符合の金額を指定することで前の取引を相殺します。たとえば、50 USD の売上を記録した取引に、後から -50 USD の全額差戻しを指定できます。 返金を発行 (Stripe を使用、または Stripe の外部で) する際には、一意の `reference` を指定して税の差戻し取引を作成する必要があります。一般的には以下のような方法があります。 - 元の参照番号にサフィックスを追加します。たとえば、元の取引の参照番号が `pi_123456789` の場合は、参照番号 `pi_123456789-refund` の差戻し取引を作成します。 - [Stripe 返金](https://docs.stripe.com/api/refunds/object.md) する ID、またはご使用のシステムの返金する ID を使用します (`re_3MoslRBUZ691iUZ41bsYVkOg` や `myRefund_456` など)。 顧客の注文を [課税するエクスポート](https://docs.stripe.com/tax/reports.md) と照合するための最適な方法を選択します。 ### 売上を全額返金する システムで売上を全額返金するには、`mode=full` を指定して差戻し取引を作成します。 以下の例の `tax_1MEFAAI6rIcR421eB1YOzACZ` は、顧客への売上を記録する税金取引です。 ```curl curl https://api.stripe.com/v1/tax/transactions/create_reversal \ -u "<>:" \ -d mode=full \ -d original_transaction=tax_1MEFAAI6rIcR421eB1YOzACZ \ -d reference=pi_123456789-cancel \ -d "expand[]"=line_items ``` これにより、作成された全額差戻し取引が返されます。 ```json { "id": "tax_1MEFtXI6rIcR421e0KTGXvCK", "object": "tax.transaction", "created": 1670866467, "currency": "eur", "customer": null, "customer_details": { "address": { "city": null, "country": "IE", "line1": null, "line2": null, "postal_code": null, "state": null }, "address_source": "billing", "ip_address": null, "tax_ids": [], "taxability_override": "none" }, "line_items": { "object": "list", "data": [ { "id": "tax_li_MyCIgTuP9F9mEU", "object": "tax.transaction_line_item", "amount": -4999, "amount_tax": -1150, "livemode": false, "metadata": { }, "quantity": 1, "reference": "L1", "reversal": { "original_line_item": "tax_li_MyBXPByrSUwm6r" }, "tax_behavior": "exclusive", "tax_code": "txcd_10000000", "type": "reversal" }, { "id": "tax_li_MyCIUNXExXmJKU", "object": "tax.transaction_line_item", "amount": -1090, "amount_tax": -90, "livemode": false, "metadata": { }, "quantity": 1, "reference": "L2", "reversal": { "original_line_item": "tax_li_MyBX3Wu3qd2mXj" }, "tax_behavior": "exclusive", "tax_code": "txcd_10000000", "type": "reversal" } ], "has_more": false, "total_count": 2, "url": "/v1/tax/transactions/tax_1MEFtXI6rIcR421e0KTGXvCK/line_items" }, "livemode": false, "metadata": { }, "reference": "pi_123456789-cancel", "reversal": { "original_transaction": "tax_1MEFAAI6rIcR421eB1YOzACZ" }, "shipping_cost": null, "tax_date": 1670863654, "type": "reversal" } ``` 取引を全額差戻しても以前の一部差戻しには影響しません。全額差戻しを記録するときは、返金の重複を避けるために、同じ取引に対する以前の一部[差戻しがすべて完了](https://docs.stripe.com/tax/custom.md#reversals-void-refund)していることを確認してください。 ### 売上を一部返金する 顧客に [返金し](https://docs.stripe.com/api/refunds/create.md) たら、`mode=partial` を指定して税の差戻し課税する取引を作成します。これにより、返金されたラインアイテムの金額を指定して一部返金を記録できます。売上ごとに最大 30 件の一部差戻しを作成できます。徴収した税額より多く差戻すと、エラーが返されます。 以下の例では、元の取引の最初のラインアイテムのみの返金が記録されます。 ```curl curl https://api.stripe.com/v1/tax/transactions/create_reversal \ -u "<>:" \ -d mode=partial \ -d original_transaction=tax_1MEFAAI6rIcR421eB1YOzACZ \ -d reference=pi_123456789-refund_1 \ -d "line_items[0][original_line_item]"=tax_li_MyBXPByrSUwm6r \ -d "line_items[0][reference]"=L1 \ -d "line_items[0][amount]"=-4999 \ -d "line_items[0][amount_tax]"=-1150 \ -d "metadata[refund]"="{{REFUND_ID}}" \ --data-urlencode "metadata[refund_reason]"="Refunded line 1 of pi_123456789 (customer was unhappy)" \ -d "expand[0]"=line_items ``` これにより、作成された一部差戻し取引が返されます。 ```json { "id": "tax_1MEFACI6rIcR421eHrjXCSmD", "object": "tax.transaction", "created": 1670863656, "currency": "eur", ... "line_items": { "object": "list", "data": [ { "id": "tax_li_MyBXC98AhtaR37", "object": "tax.transaction_line_item", "amount": -4999, "amount_tax": -1150, "livemode": false, "metadata": { }, "quantity": 1, "reference": "L1", "reversal": { "original_line_item": "tax_li_MyBXPByrSUwm6r" }, "tax_behavior": "exclusive", "tax_code": "txcd_10000000", "type": "reversal" } ], "has_more": false, "total_count": 1, "url": "/v1/tax/transactions/tax_1MEFACI6rIcR421eHrjXCSmD/line_items" }, "livemode": false, "metadata": { "refund": "{{REFUND_ID}}", "description": "Refunding pi_123456789 (customer was unhappy)" }, "reference": "pi_123456789-refund_1", "reversal": { "original_transaction": "tax_1MEFAAI6rIcR421eB1YOzACZ" }, "shipping_cost": null, "tax_date": 1670863654, "type": "reversal" } ``` 差戻されるライン項目のそれぞれについて、差戻される `amount` と `amount_tax` を指定する必要があります。元の計算のライン項目が内税だった場合、`amount` は内税です。 `amount` と `amount_tax` は以下のように状況によって決定されます。 - 取引のラインアイテムが常に 1 件のみの場合は、代わりに [全額差戻しを](https://docs.stripe.com/tax/custom.md#reversals-full) 使用します。 - 常にラインアイテム全体を返金する場合は、マイナス記号を指定して元の取引ラインアイテムの `amount` と `amount_tax` を使用します。 - ライン項目の一部を返金する場合は、返金額を計算する必要があります。たとえば、`amount=5000` と `amount_tax=500` の販売取引では、ライン項目の半分を返金した後で、`amount=-2500` と `amount_tax=-250` のライン項目で一部差戻しを作成します。 #### 一部返金で課税するレポート 税額を返金した結果、合計納税額と小計の比率が不整合となった場合、税務レポートの正確性が損なわれる可能性があります。この操作により、課税・非課税対象額の自動調整は行われません。また、税額の取り消しの理由 (商品の非課税適用、顧客の免税ステータス、リバースチャージなど) もレポートには反映されません。したがって、明細項目の税額の一部返金は行わないよう推奨いたします。正確な税額計算を行うために、対象の取引を完全に取り消してから正しい設定値で新規の取引を作成し直してください。 ### 売上を定率で一部返金する また、税額適用後に返金する定率を指定して、`mode=partial` を設定した差戻しを作成することもできます。金額は、それぞれに対する返金の残額に応じて、各ライン項目と配送料金に比例配分されます。 下記の例の取引には 2 つのラインアイテムがあります。1 つは 10 USD のアイテムで、もう 1 つは 20 USD のアイテムで、いずれも税率 10% で課税されています。取引の合計額は 33.00 USD です。定率の 16.50 USD の返金が記録されています。 ```curl curl https://api.stripe.com/v1/tax/transactions/create_reversal \ -u "<>:" \ -d mode=partial \ -d original_transaction=tax_1NVcKqBUZ691iUZ4xMZtcGYt \ -d reference=pi_234567890-refund_1 \ -d flat_amount=-1650 \ -d "metadata[refund]"="{{REFUND_ID}}" \ --data-urlencode "metadata[refund_reason]"="Refunded 16.50 USD of pi_234567890 (customer was unhappy)" \ -d "expand[]"=line_items ``` これにより、作成された一部差戻し取引が返されます。 ```json { "id": "tax_1NVcQYBUZ691iUZ4SBPukGa6", "object": "tax.transaction", "created": 1689780994, "currency": "usd", ... "line_items": { "object": "list", "data": [ { "id": "tax_li_OICqymcWjlbevq", "object": "tax.transaction_line_item", "amount": -500, "amount_tax": -50, "livemode": false, "metadata": {}, "product": null, "quantity": 1, "reference": "refund_li_1", "reversal": { "original_line_item": "tax_li_OICmRXkFuWr8Df" }, "tax_behavior": "exclusive", "tax_code": "txcd_10103000", "type": "reversal" }, { "id": "tax_li_OICq2H1qHjwyzX", "object": "tax.transaction_line_item", "amount": -1000, "amount_tax": -100, "livemode": false, "metadata": {}, "product": null, "quantity": 1, "reference": "refund_li_2", "reversal": { "original_line_item": "tax_li_OICmxhnSJxF7rY" }, "tax_behavior": "exclusive", "tax_code": "txcd_10103000", "type": "reversal" } ], "has_more": false, "total_count": 2, "url": "/v1/tax/transactions/tax_1NVcQYBUZ691iUZ4SBPukGa6/line_items" }, "livemode": false, "metadata": { "refund": "{{REFUND_ID}}", "description": "Refunding pi_234567890 (customer was unhappy)" }, "reference": "pi_234567890-refund_1", "reversal": { "original_transaction": "tax_1NVcKqBUZ691iUZ4xMZtcGYt" }, "shipping_cost": null, "tax_date": 1670863654, "type": "reversal" } ``` 元の取引の各ライン項目と配送料に対して、返金額と税金が以下のように計算されます。 1. まず、返金に利用できる取引の残額の合計を計算します。この取引には他に差戻しが記録されていないため、合計金額は 33.00 USD です。 1. 次に、各アイテムに対する返金額の合計を計算します。この計算は返金に利用できる額と取引の残額合計の比率を基準にします。たとえば、10 USD のアイテムは、返金対象の残額合計が 11.00 USD であり、取引の残額合計の 33.33% に相当するため、返金される合計金額は `-16.50 USD * 33.33% = -5.50 USD` となります。 1. 最後に、返金対象の合計金額が `amount` と `amount_tax` に分割されます。これについても、ラインアイテムでと返金対象の残額合計を比較して返金に利用できる税額に応じて比例的に計算されます。10 USD のアイテムを例にすると、税金 (1.00 USD) は返金対象の残額合計 (11.00 USD) の 9.09% に相当するので、`amount_tax` は `-5.50 USD * 9.09% = -0.50 USD` となります。 最初に記録されていた額ではなく、取引の返金対象の_残額_に応じて一定額が配分されます。たとえば、定額の 16.50 USD の返金を記録するのではなく、まず 10 USD の項目の合計額の部分差戻しを記録する場合を考えてみましょう。 ```curl curl https://api.stripe.com/v1/tax/transactions/create_reversal \ -u "<>:" \ -d mode=partial \ -d original_transaction=tax_1NVcKqBUZ691iUZ4xMZtcGYt \ -d reference=pi_234567890-refund_1 \ -d "line_items[0][original_line_item]"=tax_li_OICmRXkFuWr8Df \ -d "line_items[0][reference]"=partial_refund_l1 \ -d "line_items[0][amount]"=-1000 \ -d "line_items[0][amount_tax]"=-100 \ -d "metadata[refund]"="{{REFUND_ID}}" \ --data-urlencode "metadata[refund_reason]"="Refunded line 1 of pi_234567890 (customer was unhappy)" \ -d "expand[0]"=line_items ``` この後に、16.50 USD の定率の金額の差戻しを記録します。 ```curl curl https://api.stripe.com/v1/tax/transactions/create_reversal \ -u "<>:" \ -d mode=partial \ -d original_transaction=tax_1NVcKqBUZ691iUZ4xMZtcGYt \ -d reference=pi_234567890-refund_2 \ -d flat_amount=-1650 \ -d "metadata[refund]"="{{REFUND_ID}}" \ --data-urlencode "metadata[refund_reason]"="Refunded 16.50 USD of pi_234567890 (customer was still unhappy)" \ -d "expand[]"=line_items ``` これで部分差戻し取引が返されます。 ```json { "id": "tax_1NVxFIBUZ691iUZ4saOIloxB", "object": "tax.transaction", "created": 1689861020, "currency": "usd", ... "line_items": { "object": "list", "data": [ { "id": "tax_li_OIYM8xd8BzrATd", "object": "tax.transaction_line_item", "amount": 0, "amount_tax": 0, "livemode": false, "metadata": {}, "product": null, "quantity": 1, "reference": "refund_li_1", "reversal": { "original_line_item": "tax_li_OICmRXkFuWr8Df" }, "tax_behavior": "exclusive", "tax_code": "txcd_10103000", "type": "reversal" }, { "id": "tax_li_OIYMNBH6s8oQj9", "object": "tax.transaction_line_item", "amount": -1500, "amount_tax": -150, "livemode": false, "metadata": {}, "product": null, "quantity": 1, "reference": "refund_li_2", "reversal": { "original_line_item": "tax_li_OICmxhnSJxF7rY" }, "tax_behavior": "exclusive", "tax_code": "txcd_10103000", "type": "reversal" } ], "has_more": false, "total_count": 2, "url": "/v1/tax/transactions/tax_1NVxFIBUZ691iUZ4saOIloxB/line_items" }, "livemode": false, "metadata": {}, "reference": "pi_234567890-refund_2", "reversal": { "original_transaction": "tax_1NVcKqBUZ691iUZ4xMZtcGYt" }, "shipping_cost": null, "tax_date": 1670863654, "type": "reversal" } ``` 取引で残っている金額の合計が 22.00 USD であり、10 USD のアイテムが全額返金されているため、16.50 USD の全体が 20 USD のアイテムに配分されます。次に、16.50 USD がステップ 3 のロジックを使用して、`amount = -15.00 USD` と `amount_tax = -1.50 USD` に配分されます。一方、取引の 10 USD のアイテムには 0 USD の返金が記録されます。 ### 一部返金を取り消す 税金取引は変更できませんが、[full reversal](https://docs.stripe.com/api/tax/transactions/create_reversal.md#tax_transaction_create_reversal-mode) を作成することで一部返金をキャンセルできます。 この処理が必要になる状況を以下に示します。 - 支払いの [返金に失敗](https://docs.stripe.com/refunds.md#failed-refunds) し、顧客に商品やサービスを提供していない場合 - 誤った注文が返金されたか、誤った金額が返金された場合 - 元の売上が全額返金され、一部返金が無効になった場合 以下の例の `tax_1MEFACI6rIcR421eHrjXCSmD` は一部返金を表す取引です。 ```curl curl https://api.stripe.com/v1/tax/transactions/create_reversal \ -u "<>:" \ -d mode=full \ -d original_transaction=tax_1MEFACI6rIcR421eHrjXCSmD \ -d reference=pi_123456789-refund_1-cancel \ -d "metadata[refund_reason]"="User called to cancel because they selected the wrong item" \ -d "expand[]"=line_items ``` これにより、作成された全額差戻し取引が返されます。 ```json { "id": "tax_1MEFADI6rIcR421e94fNTOCK", "object": "tax.transaction", "created": 1670863657, "currency": "eur", ... "line_items": { "object": "list", "data": [ { "id": "tax_li_MyBXMOlwenCyFB", "object": "tax.transaction_line_item", "amount": 4999, "amount_tax": 1150, "livemode": false, "metadata": { }, "quantity": 1, "reference": "L1", "reversal": { "original_line_item": "tax_li_MyBXC98AhtaR37" }, "tax_behavior": "exclusive", "tax_code": "txcd_10000000", "type": "reversal" } ], "has_more": false, "total_count": 1, "url": "/v1/tax/transactions/tax_1MEFADI6rIcR421e94fNTOCK/line_items" }, "livemode": false, "metadata": { "refund_reason": "User called to cancel because they picked the wrong item" }, "reference": "pi_123456789-refund_1-cancel", "reversal": { "original_transaction": "tax_1MEFACI6rIcR421eHrjXCSmD" }, "shipping_cost": null, "tax_date": 1670863654, "type": "reversal" } ``` ## テスト 本番環境と同じ応答構造である *サンドボックス* を使用して、本番環境へ移行する前に導入が正しく機能することを確認します。 > テスト環境では、計算が最新の税金結果を返すことを保証していません。税金計算は 1 日あたり 1,000 件に制限されています。上限を引き上げる必要がある場合は、[Stripe サポート](https://support.stripe.com/contact) にお問い合わせください。テスト環境における自動テストとレート制限を回避するための戦略に関するガイダンスについては、[自動テスト](https://docs.stripe.com/automated-testing.md) を参照してください。 ## 税金取引を表示する ダッシュボードの[税取引](https://dashboard.stripe.com/test/tax/transactions)ページで、アカウントのすべての税取引を確認できます。個々の取引をクリックすると、計算された税金の詳細な内訳が、管轄区域別および取引に含まれる個々の商品別に表示されます。 > 税金取引のページには *取引* のみが表示され、_計算_は表示されません。計算が表示されるはずなのにこのページにない場合は、計算によって正常に [税金取引](https://docs.stripe.com/tax/custom.md#tax-transaction) が作成されていることを確認してください。 ## Optional: 導入の例 決済手段の詳細を収集して [PaymentIntent を作成](https://docs.stripe.com/payments/accept-a-payment.md?payment-ui=elements&api-integration=paymentintents#web-create-intent)する前に、顧客の税金を計算できます。たとえば、顧客が郵便番号を指定したときにショッピングカートの合計を表示できます。 以下の例では、クライアント側のフォームから顧客の住所が送信される宛先の `/preview-cart` エンドポイントをサーバー側で定義しています。サーバーでは、カートのラインアイテムと顧客の住所を組み合わせて税金が計算されます。 #### Node.js ```javascript // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys const stripe = require('stripe')('<>'); const express = require('express'); const app = express(); // Parse the request body as JSON. app.use(express.json()); app.post('/preview-cart', async (req, res) => { const cart = ...; // Load the cart/order from your system // Convert each cart item to a Stripe line item object const lineItems = cart.items.map( cartItem => ({ reference: cartItem.id, amount: cartItem.unitPrice * cartItem.quantity, quantity: cartItem.quantity }) ); // Get the customer's address from the request body const address = req.body.address; // Create a tax calculation using the Stripe API const calculation = await stripe.tax.calculations.create({ currency: cart.currency, line_items: lineItems, customer_details: { address: { line1: address.line1, city: address.city, state: address.state, postal_code: address.postal_code, country: address.country, }, address_source: "billing" }, expand: ['line_items.data.tax_breakdown'] }); // Return the tax amount as a JSON response res.json({ tax_amount: calculation.tax_amount_exclusive }); }); app.listen(4242, () => { console.log('Running on port 4242'); }); ``` 決済を受ける準備が整ったら、税金の計算結果から PaymentIntent を作成します。PaymentIntent の [metadata](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-metadata) または独自のデータベースに税金計算 ID を保存することで、顧客が決済を完了したときに税金取引を作成できます。 次の例では、税金を計算し、PaymentIntent を作成 (または更新) し、クライアントに結果を返すサーバーエンドポイントを示しています。その後、顧客に税金を表示できます。`client_secret` を使用して[支払いを受け付けます](https://docs.stripe.com/payments/accept-a-payment.md?payment-ui=elements&api-integration=paymentintents#web-collect-payment-details)。 #### Node.js ```javascript // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys const stripe = require('stripe')('<>'); const express = require('express'); const app = express(); // Parse the request body as JSON. app.use(express.json()); app.post('/calculate-cart', async (req, res) => { const cart = ...; // Load the cart/order from your system // Create a tax calculation using the Stripe API const calculation = await stripe.tax.calculations.create(...); let paymentIntent; // Update the PaymentIntent if one already exists for this cart. if (cart.paymentIntent) { paymentIntent = await stripe.paymentIntents.update(cart.paymentIntent, { amount: calculation.amount_total, metadata: {tax_calculation: calculation.id}, }); } else { paymentIntent = await stripe.paymentIntents.create({ currency: cart.currency, amount: calculation.amount_total, metadata: {tax_calculation: calculation.id}, // In the latest version of the API, specifying the `automatic_payment_methods` parameter is optional because Stripe enables its functionality by default. automatic_payment_methods: {enabled: true}, }); } // Store PaymentIntent ID in cart or customer session. cart.paymentIntent = paymentIntent.id; // Return calculated amounts and PaymentIntent secret to the client. res.json({ total: calculation.amount_total, tax_amount: calculation.tax_amount_exclusive, client_secret: paymentIntent.client_secret }); }); app.listen(4242, () => { console.log('Running on port 4242'); }); ``` 貴社の連携機能で Payment Element を使用している場合は、PaymentIntent の更新後に[サーバーから更新](https://docs.stripe.com/payments/accept-a-payment.md?payment-ui=elements&api-integration=paymentintents#fetch-updates)を取得します。 ## Optional: 配送料金の税金を計算する [サーバー側] 配送料金の税金を計算するには、`shipping_cost` パラメーターを使用します。 ```curl curl https://api.stripe.com/v1/tax/calculations \ -u "<>:" \ -d currency=usd \ -d "line_items[0][amount]"=1000 \ -d "line_items[0][reference]"=L1 \ -d "customer_details[address][line1]"="920 5th Ave" \ -d "customer_details[address][city]"=Seattle \ -d "customer_details[address][state]"=WA \ -d "customer_details[address][postal_code]"=98104 \ -d "customer_details[address][country]"=US \ -d "customer_details[address_source]"=shipping \ -d "shipping_cost[amount]"=500 \ -d "shipping_cost[tax_code]"=txcd_92010001 ``` 既存の [ShippingRate](https://docs.stripe.com/api/shipping_rates/object.md) の ID を渡して、その `amount`、`課税する tax_code`、`課税する tax_behavior` を使用します。 ```curl curl https://api.stripe.com/v1/tax/calculations \ -u "<>:" \ -d currency=usd \ -d "line_items[0][amount]"=1000 \ -d "line_items[0][reference]"=L1 \ -d "customer_details[address][line1]"="920 5th Ave" \ -d "customer_details[address][city]"=Seattle \ -d "customer_details[address][state]"=WA \ -d "customer_details[address][postal_code]"=98104 \ -d "customer_details[address][country]"=US \ -d "customer_details[address_source]"=shipping \ -d "shipping_cost[shipping_rate]"=shr_1Mlh8YI6rIcR421eUr9SJzAD ``` ## Optional: IP アドレスを使用して税金を見積もる [サーバー側] 顧客の [IP アドレス](https://docs.stripe.com/api/tax/calculations/create.md#calculate_tax-customer_details-ip_address) を指定すると、Stripe はその地理的な位置を特定し、その場所を顧客の所在地として使用します。これにより、顧客が郵便番号を入力する前に税金の見積もりを表示できます。 > IP アドレスの場所は顧客の実際の場所から離れている可能性があるため、徴収する *最終的な* 税額を決定するのに IP アドレスを使用することはお勧めしません。 ```curl curl https://api.stripe.com/v1/tax/calculations \ -u "<>:" \ -d currency=usd \ -d "line_items[0][amount]"=1000 \ -d "line_items[0][reference]"=L1 \ -d "customer_details[ip_address]"="127.0.0.1" ``` ## Optional: 顧客の Tax ID を収集する [サーバー側] 国外へのサービスの提供など、顧客に [リバースチャージ](https://docs.stripe.com/tax/zero-tax.md#reverse-charges) に基づく税金の必要が生じる場合があります。税金を回収せず、代わりに「差戻し請求で支払われる税金」という文言を指定して請求書を発行する必要があります。これにより、購入に関連する納税が顧客の責任であることを顧客に伝えることができます。 顧客の[納税者番号](https://docs.stripe.com/api/tax/calculations/create.md#calculate_tax-customer_details-tax_ids)を指定して、リバースチャージが適用される状況を自動的に判別するには、以下のようにします。 ```curl curl https://api.stripe.com/v1/tax/calculations \ -u "<>:" \ -d currency=usd \ -d "line_items[0][amount]"=1000 \ -d "line_items[0][reference]"=L1 \ -d "customer_details[address][country]"=IE \ -d "customer_details[address_source]"=billing \ -d "customer_details[tax_ids][0][type]"=eu_vat \ -d "customer_details[tax_ids][0][value]"=DE123456789 ``` 無効な形式の納税者番号を指定すると、計算で `tax_id_invalid` エラーコードが返されます。 ```json { "error": { "code": "tax_id_invalid", "doc_url": "https://docs.stripe.com/error-codes#tax-id-invalid", "message": "Invalid value for eu_vat.", "param": "customer_details[tax_ids][0][value]", "type": "invalid_request_error" } } ``` Tax API では、納税者番号を政府のデータベースで自動的に検証しません。税金の計算前に納税者番号を検証するには、[customer tax ID validation](https://docs.stripe.com/billing/customer/tax-ids.md#validation) を使用する必要があります。 ## Optional: 内税価格 [サーバー側] デフォルトでは、指定したライン項目と配送料の金額に加算して税金が計算されます。価格に含まれる税金を計算するには、[line item](https://docs.stripe.com/api/tax/calculations/create.md#calculate_tax-line_items-tax_behavior) または [shipping cost](https://docs.stripe.com/api/tax/calculations/create.md#calculate_tax-shipping_cost-tax_behavior) の `tax_behavior` を `inclusive` に設定します。 以下の例では、顧客は常に 100 EUR を決済します。 ```curl curl https://api.stripe.com/v1/tax/calculations \ -u "<>:" \ -d currency=eur \ -d "line_items[0][amount]"=10000 \ -d "line_items[0][reference]"=L1 \ -d "line_items[0][tax_behavior]"=inclusive \ -d "line_items[0][tax_code]"=txcd_10103000 \ -d "customer_details[address][country]"=IE \ -d "customer_details[address_source]"=billing ``` レスポンスでは税込み価格が返されます。 ```json { ... "amount_total": 10000, ... "tax_amount_exclusive": 0,"tax_amount_inclusive": 1870, "tax_breakdown": [ { "amount": 1870, "inclusive": true, "tax_rate_details": { "country": "IE", "percentage_decimal": "23.0", "state": null, "tax_type": "vat" }, "taxability_reason": "standard_rated", "taxable_amount": 8130 } ], ... } ``` ## Optional: 既存の Product オブジェクトを使用する [サーバー側] 各ライン項目に [Product](https://docs.stripe.com/api/products/object.md) オブジェクトを指定できます。商品に [tax_code](https://docs.stripe.com/api/products/object.md#product_object-tax_code) がある場合、まだ入力されていない場合はライン項目の `tax_code` として使用されます。`tax_behavior` や `price` など、他の商品の値は税金計算時に使用されません。 ```curl curl https://api.stripe.com/v1/tax/calculations \ -u "<>:" \ -d currency=usd \ -d "line_items[0][amount]"=1000 \ -d "line_items[0][reference]"=L1 \ -d "line_items[0][product]"="{{PRODUCT_ID}}" \ -d "customer_details[address][country]"=IE \ -d "customer_details[address_source]"=billing ``` ## Optional: 既存の Account または Customer を使用する [サーバー側] 税金計算では、顧客データの利用可能状況に応じて、関連する [Customer](https://docs.stripe.com/api/customers/object.md) の住所と税務 ID が自動的に使用されます。 - 顧客の配送先住所が計算の `customer_details.address` に入力されます。 - それ以外の場合は、顧客の住所が計算の `customer_details.address` に入力されます。 - 顧客の IP アドレスが計算の `customer_details.ip_address` に入力されます。 - 顧客に非課税が設定されている場合、計算の `customer_details.taxability_override` に入力されます。 - 顧客の税務 ID が計算の `customer_details.tax_ids` に入力されます。 ```curl curl https://api.stripe.com/v1/tax/calculations \ -u "<>:" \ -d currency=usd \ -d "line_items[0][amount]"=1000 \ -d "line_items[0][reference]"=L1 \ -d customer="{{CUSTOMER_ID}}" ``` ## Optional: 顧客の課税対象を上書きする [サーバー側] 顧客が非課税である場合など、特定のケースでは税金を徴収する必要はありません。[taxability_override](https://docs.stripe.com/api/tax/calculations/create.md#calculate_tax-customer_details-taxability_override) パラメーターを使用して、Stripe Tax に税金免除を指定できます。 顧客の課税対象の上書きを計算に指定するには、以下のようにします。 ```curl curl https://api.stripe.com/v1/tax/calculations \ -u "<>:" \ -d currency=usd \ -d "line_items[0][amount]"=1000 \ -d "line_items[0][reference]"=L1 \ -d "customer_details[address][line1]"="920 5th Ave" \ -d "customer_details[address][city]"=Seattle \ -d "customer_details[address][state]"=WA \ -d "customer_details[address][postal_code]"=98104 \ -d "customer_details[address][country]"=US \ -d "customer_details[address_source]"=billing \ -d "customer_details[taxability_override]"=customer_exempt ``` ### リバースチャージ 欧州連合などの一部の地域は、顧客がビジネスとして購入する場合に課税対象となる「リバースチャージ」スキームを実装しています。Stripe Tax が正確な税金処理を適用できるように、顧客から [Tax IDs](https://docs.stripe.com/tax/custom.md#tax-ids) を収集することをお勧めします。顧客の納税者番号を収集できない場合や、リバースチャージスキームの適用を別途決定している場合があります。そのような場合は、`taxability_override` を使用して、Stripe Tax でリバースチャージスキームを強制的に適用できます。 顧客の課税対象の上書きを計算に指定するには、以下のようにします。 ```curl curl https://api.stripe.com/v1/tax/calculations \ -u "<>:" \ -d currency=eur \ -d "line_items[0][amount]"=1000 \ -d "line_items[0][reference]"=L1 \ -d "customer_details[address][country]"=IE \ -d "customer_details[address_source]"=billing \ -d "customer_details[taxability_override]"=reverse_charge ``` ## Optional: 配送元住所を指定する [サーバー側] 主たるビジネス拠点以外の場所から商品を配送する場合、配送元住所を登録して税金計算に使用できます。 発送元の所在地を指定するには、`ship_from_details` パラメータを使用します。この例では、ユーザーはフロリダ州に拠点を置き、顧客はイリノイ州スプリングフィールドにおり、商品はイリノイ州ネイパービルから発送されています。 ```curl curl https://api.stripe.com/v1/tax/calculations \ -u "<>:" \ -d currency=usd \ -d "line_items[0][amount]"=1000 \ -d "line_items[0][reference]"=L1 \ -d "line_items[0][tax_behavior]"=exclusive \ -d "line_items[0][tax_code]"=txcd_99999999 \ -d "customer_details[address][city]"=Springfield \ -d "customer_details[address][state]"=IL \ -d "customer_details[address][postal_code]"=62704 \ -d "customer_details[address][country]"=US \ -d "customer_details[address_source]"=billing \ -d "ship_from_details[address][city]"=Naperville \ -d "ship_from_details[address][state]"=IL \ -d "ship_from_details[address][postal_code]"=60540 \ -d "ship_from_details[address][country]"=US ``` このレスポンスでは、配送先 (イリノイ州スプリングフィールド) または売り手のビジネス拠点ではなく、注文の配送元 (イリノイ州ネイパービル) に基づいて計算された税金が返されます。 ```json { ... "amount_total": 1078, ... "tax_amount_exclusive": 78, ... "tax_breakdown": [ { "amount": 78, "inclusive": true,"tax_rate_details": { "country": "US", "percentage_decimal": "7.75", "state": "IL", "tax_type": "sales_tax" }, "taxability_reason": "standard_rated", "taxable_amount": 1000 } ], ... } ``` これらのシナリオにおける税金の計算方法については、[Stripe Tax のドキュメント ](https://docs.stripe.com/tax/calculating.md) をご覧ください。 ## Optional: 小売業配送手数料の計算 [サーバー側] Stripe Tax は、ミネソタ州とコロラド州の小売業配送手数料の計算をサポートしています。 サポートされている州で `state_retail_delivery_fee` タイプの税務登録を追加すると、小売業の配送手数料が税金計算で計算されます。 ```curl curl https://api.stripe.com/v1/tax/registrations \ -u "<>:" \ -d country=US \ -d "country_options[us][state]"=CO \ -d "country_options[us][type]"=state_retail_delivery_fee \ -d active_from=now ``` 小売業の配送手数料を計算するには、衣料品と履物を表す `txcd_30011000` などの [物品商品税コード](https://docs.stripe.com/tax/tax-codes.md?type=physical) を使用して税金計算 API を呼び出します。 すべての物品が小売業の配送手数料の計算をトリガーするわけではありません。税金が適用されるタイミングについては、州のドキュメントをご覧ください。 - [小売配送手数料 — コロラド州](https://docs.stripe.com/tax/supported-countries/united-states/collect-tax.md?tax-jurisdiction-united-states=colorado#other-taxes) - [小売配送手数料 — ミネソタ州](https://docs.stripe.com/tax/supported-countries/united-states/collect-tax.md?tax-jurisdiction-united-states=minnesota#other-taxes) ```curl curl https://api.stripe.com/v1/tax/calculations \ -u "<>:" \ -d currency=usd \ -d "line_items[0][amount]"=1000 \ -d "line_items[0][reference]"=L1 \ -d "line_items[0][tax_behavior]"=exclusive \ -d "line_items[0][tax_code]"=txcd_30011000 \ -d "shipping_cost[amount]"=400 \ -d "customer_details[address][line1]"="1437 Bannock St Room 451" \ -d "customer_details[address][city]"=Springfield \ -d "customer_details[address][state]"=CO \ -d "customer_details[address][postal_code]"=80202 \ -d "customer_details[address][country]"=US \ -d "customer_details[address_source]"=shipping ``` レスポンスは、コロラド州の小売業配送手数料で計算された税金を返します。これは `tax_breakdown` オブジェクトの追加エントリーであり、`tax_breakdown.tax_rate_details.rate_type` は `flat_amount` に設定されています。 ```json { ... "amount_total": 2165, ... "tax_amount_exclusive": 165, ... "tax_breakdown": [ { "amount": 88, "inclusive": false, "tax_rate_details": { "percentage_decimal": "8.81", "rate_type": "percentage", "tax_type": "sales_tax", ... }, "taxability_reason": "standard_rated", "taxable_amount": 1000 }, ... { "amount": 29, "inclusive": false,"tax_rate_details": { "flat_amount": { "amount": 29, "currency": "usd" }, "percentage_decimal": "0.0", "rate_type": "flat_amount", "tax_type": "retail_delivery_fee", ... }, "taxability_reason": "standard_rated", "taxable_amount": 1000 } ], ... } ``` ## Optional: ライン項目の詳細な税金の内訳 [サーバー側] 最上位の [tax_breakdown](https://docs.stripe.com/api/tax/calculations/object.md#tax_calculation_object-tax_breakdown) は常に返され、Checkout 時または領収書に税金のリストを表示するのに適したシンプルな内訳が表示されます。 [taxability_reason](https://docs.stripe.com/api/tax/calculations/object.md#tax_calculation_object-line_items-data-tax_breakdown-taxability_reason) を使用して、導入の構築時に税金が適用されない理由を把握できます。たとえば、`not_collecting` では、税金を徴収する国または州で税金が徴収されません。アカウント設定に [tax registrations](https://docs.stripe.com/tax/set-up.md#add-registrations) を追加すると、Stripe に税金を徴収する場所が示されます。ワシントン州の登録を追加した場合、結果に表示される課税対象の理由は `standard_rated` になり、これは商品が標準税率で課税されることを示します。 ライン項目の [tax_breakdown](https://docs.stripe.com/api/tax/calculations/object.md#tax_calculation_object-line_items-data-tax_breakdown) 属性を展開すると、地方税や各税金の理由を説明する属性など、詳細な内訳が表示されます。 - [課税する](https://docs.stripe.com/api/tax/calculations/object.md#tax_calculation_object-line_items-data-tax_breakdown-tax_rate_details) `rate_details` の tax_type フィールドは、課税する税金の種類を示す上位レベルであり、レポートや取引のエクスポートで返されるタイプとは必ずしも一致しない場合があります。たとえば、アメリカ売上税とアメリカ使用税を区別しません。 - Checkout フローの [tax_rate_details](https://docs.stripe.com/api/tax/calculations/object.md#tax_calculation_object-line_items-data-tax_breakdown-tax_rate_details) の `display_name` フィールドを使用して、すべての税金を表示します。税金は、顧客の場所と商品の税金情報に基づいてローカライズされます。例えば、[txcd_10103001: Software as a Service (SaaS) for Business Use](https://docs.stripe.com/tax/tax-codes.md?tax_code=txcd_10103001) のように、顧客がドイツに所在して、商品が仕向地で課税されるため、ドイツに VAT が適用される場合、`Umsatzsteuer (USt)`と表示されます。これは、VAT のドイツ語表記です。[txcd_20030000: General - Services](https://docs.stripe.com/tax/tax-codes.md?tax_code=txcd_20030000) のように、本社の住所がフランスに設定され、商品が起点で課税されるため、フランスに VAT が適用される場合、`Taxe sur la valeur ajoutée (TVA)` と表示されます。これは、VAT のフランス語表記です。 ```curl curl https://api.stripe.com/v1/tax/calculations \ -u "<>:" \ -d currency=usd \ -d "line_items[0][amount]"=1000 \ -d "line_items[0][reference]"=L1 \ -d "customer_details[address][line1]"="920 5th Ave" \ -d "customer_details[address][city]"=Seattle \ -d "customer_details[address][state]"=WA \ -d "customer_details[address][postal_code]"=98104 \ -d "customer_details[address][country]"=US \ -d "customer_details[address_source]"=shipping \ -d "expand[0]"="line_items.data.tax_breakdown" ``` ```json { ... "tax_breakdown": [ { "amount": 103, "inclusive": false, "tax_rate_details": { "country": "US", "percentage_decimal": "10.25", "state": "WA", "tax_type": "sales_tax" },"taxability_reason": "standard_rated", "taxable_amount": 1000 } ], "line_items": { "object": "list", "data": [ { "id": "tax_li_O84jA8hvV7ZyAa", "object": "tax.calculation_line_item", "amount": 1000, "amount_tax": 103, "product": null, "quantity": 1, "reference": "L1", "tax_behavior": "exclusive", "tax_breakdown": [ { "amount": 65, "jurisdiction": { "country": "US", "display_name": "Washington", "level": "state", "state": "WA" }, "sourcing": "destination", "tax_rate_details": { "display_name": "Retail Sales and Use Tax", "percentage_decimal": "6.5", "tax_type": "sales_tax" },"taxability_reason": "standard_rated", "taxable_amount": 1000 }, { "amount": 0, "jurisdiction": { "country": "US", "display_name": "KING", "level": "county", "state": "WA" }, "sourcing": "destination", "tax_rate_details": null,"taxability_reason": "not_subject_to_tax", "taxable_amount": 0 }, { "amount": 22, "jurisdiction": { "country": "US", "display_name": "SEATTLE", "level": "city", "state": "WA" }, "sourcing": "destination", "tax_rate_details": { "display_name": "Local Sales and Use Tax", "percentage_decimal": "2.2", "tax_type": "sales_tax" },"taxability_reason": "standard_rated", "taxable_amount": 1000 }, { "amount": 14, "jurisdiction": { "country": "US", "display_name": "REGIONAL TRANSIT AUTHORITY", "level": "district", "state": "WA" }, "sourcing": "destination", "tax_rate_details": { "display_name": "Local Sales and Use Tax", "percentage_decimal": "1.4", "tax_type": "sales_tax" },"taxability_reason": "standard_rated", "taxable_amount": 1000 }, { "amount": 2, "jurisdiction": { "country": "US", "display_name": "SEATTLE TRANSPORTATION BENEFIT DISTRICT", "level": "district", "state": "WA" }, "sourcing": "destination", "tax_rate_details": { "display_name": "Local Sales and Use Tax", "percentage_decimal": "0.15", "tax_type": "sales_tax" },"taxability_reason": "standard_rated", "taxable_amount": 1000 } ], "tax_code": "txcd_10000000" } ], "has_more": false, "total_count": 1, "url": "/v1/tax/calculations/taxcalc_1NLoZvBUZ691iUZ4z4cTW6tQ/line_items" }, ... } ``` ## Optional: 一般的なエラーのトラブルシューティング [サーバー側] 税務インテグレーションのエラーをトラブルシューティングするには、以下のステップに従います。 ### 無効な課税するコードのエラーを解決する `Invalid tax code` エラーが表示された場合は、[Product tax codes](https://docs.stripe.com/tax/tax-codes.md) を参照して、利用可能な税コードのリストを確認してください。次に、以下の手順に従って問題を解決します。 1. **税コードを確認する**: [利用可能な税コードのリスト](https://docs.stripe.com/tax/tax-codes.md) から、有効な税コードを使用していることを確認してください。よくある間違いは次のとおりです。 - 課税するコードとして空の文字列または `null` を使用する - 課税するコードのスペルミス - 存在しない課税するコードを使用する 1. **コードを更新**: `TaxCalculation` を作成する際には、必ず有効な課税コードを渡してください。以下に例を示します。 ```curl curl https://api.stripe.com/v1/tax/calculations \ -u "<>:" \ -d currency=usd \ -d "line_items[0][amount]"=1000 \ -d "line_items[0][reference]"=L1 \ -d "line_items[0][tax_code]"=txcd_10000000 \ -d "customer_details[address][line1]"="354 Oyster Point Blvd" \ -d "customer_details[address][city]"="South San Francisco" \ -d "customer_details[address][state]"=CA \ -d "customer_details[address][postal_code]"=94080 \ -d "customer_details[address][country]"=US \ -d "customer_details[address_source]"=shipping ``` 1. **デフォルトの税コードを使用**: Stripe Tax は、商品または税金計算リクエストに特定の税コードが指定されていない場合、計算にデフォルトの税コードを使用します。税金設定でデフォルト値を表示および更新できます。 API を使用して、デフォルトの税コードを更新します。 ```curl curl https://api.stripe.com/v1/tax/settings \ -u "<>:" \ -d "defaults[tax_code]"=txcd_10000000 ``` 1. **商品カタログのレビュー**: Stripe 商品カタログの商品に関連付けられた税コードを使用する場合は、税コードが商品に正しく割り当てられていることを確認してください。 1. **データの不整合の確認**: 税コードがデータベースまたはフロントエンドから、Stripe への API コールを行うサーバー側のコードに正しく渡されることを確認します。 課税する税額を正確に計算するには、商品またはサービスに適用される最も具体的な税コードを使用します。課税するコードが不明な場合は、[課税する税コードのドキュメント](https://docs.stripe.com/tax/tax-codes.md) をご覧ください。 問題が続く場合は、[課税する API ドキュメント](https://docs.stripe.com/api/tax/settings.md) をレビューしてください。 ## 顧客の Tax ID を収集する *請求書* (Invoices are statements of amounts owed by a customer. They track the status of payments from draft through paid or otherwise finalized. Subscriptions automatically generate invoices, or you can manually create a one-off invoice) に顧客の納税者番号と法務ビジネス名を表示することは、一般的な要件です。[納税者番号 Element](https://docs.stripe.com/elements/tax-id-element.md) を使用して、この情報を回収することができます。この機能は[公開プレビュー](https://docs.stripe.com/release-phases.md)です。 > #### 免責条項 > > Payment Intents API は事業の Tax ID を収集するように設計されています。これは、特定の管轄区域では個人の Tax ID に似た形式になる場合があります。この機能を使用する際には、このフィールドに指定された事業の Tax ID のみを提供する必要があります。 ### ベータを有効にする Payment Intents API を使用する納税者番号 Element では、`elements_tax_id_1` ベータを有効にする必要があります。Stripe.js の初期化にベータを追加します。 ```javascript const stripe = Stripe('<>', { betas: ['elements_tax_id_1'], }); ``` ### CustomerSession を作成する (オプション) 税務 ID を保存してリピーターの顧客に再表示するには、[CustomerSession](https://docs.stripe.com/api/customer_sessions.md) を作成します。これにより、シークレット API キーをクライアントに公開することなく、顧客データへの安全で一時的なアクセスを提供します。 `CustomerSession` を使用しなくても、納税者番号 Element は機能しますが、保存と再表示の機能はありません。[getValue](https://docs.stripe.com/js/elements_object/get_value_tax_id_element) を使用して、納税者番号の値を Element から読み取り、手動で処理できます。 #### Customer v1 *Customer* (Customer objects represent customers of your business. They let you reuse payment methods and give you the ability to track multiple payments) を作成または取得します。 ```curl curl https://api.stripe.com/v1/customers \ -u "<>:" \ --data-urlencode email="customer@example.com" \ -d name="Jenny Rosen" ``` 納税者番号 Element コンポーネントを有効にして `CustomerSession` を作成します。 ```curl curl https://api.stripe.com/v1/customer_sessions \ -u "<>:" \ -H "Stripe-Version: 2026-03-04.preview" \ -d customer="{{CUSTOMER_ID}}" \ -d "components[tax_id_element][enabled]"=true \ -d "components[tax_id_element][features][tax_id_redisplay]"=enabled \ -d "components[tax_id_element][features][tax_id_save]"=enabled ``` `CustomerSession` は `client_secret` を返します。これをクライアント側に渡します。 ### PaymentIntent または SetupIntent を作成する サーバーで [PaymentIntent](https://docs.stripe.com/api/payment_intents.md) または [SetupIntent](https://docs.stripe.com/api/setup_intents.md) を作成します。`CustomerSession` を使用する場合は、税務 ID の保存および再表示機能を有効にするために、顧客参照パラメータを含めてください。 #### Customer v1 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d amount=1099 \ -d currency=usd \ -d customer="{{CUSTOMER_ID}}" ``` > PaymentIntent または SetupIntent を作成する際に、税務 ID 固有のパラメータを含める必要はありません。Tax ID Element は、適切な権限を持つ CustomerSession を使用する場合、税務 ID の収集を自動的に処理し、*Customer* (Customer objects represent customers of your business. They let you reuse payment methods and give you the ability to track multiple payments) に保存します。 ### Elements を初期化 PaymentIntent または SetupIntent の `clientSecret` を使用して Elements インスタンスを作成します。 顧客に納税者番号を保存し、リピート顧客に再表示できるようにするには、`customerSessionClientSecret` を含めます。 ```javascript const stripe = Stripe('<>', { betas: ['elements_tax_id_1'], }); // Fetch the clientSecret from your server const {clientSecret} = await fetch('/create-payment-intent', { method: 'POST', headers: { 'Content-Type': 'application/json' }, }).then((res) => res.json()); // Fetch the customerSessionClientSecret from your server const {customerSessionClientSecret} = await fetch('/create-customer-session', { method: 'POST', headers: { 'Content-Type': 'application/json' }, }).then((res) => res.json()); const elements = stripe.elements({ clientSecret,customerSessionClientSecret, appearance: { /* ... */ } }); ``` ### 納税者番号 Element の作成とマウント 納税者番号 Element のインスタンスを作成し、ページにマウントします。 ```html
``` ```javascript const taxIdElement = elements.create('taxId', { visibility: 'auto', // 'auto' | 'always' | 'never' }); taxIdElement.mount('#tax-id-element'); ``` 納税者番号 Element は `visibility`、`fields`、`validation` などのオプションを使用してカスタマイズできます。詳細については、[納税者番号 Element の作成](https://docs.stripe.com/js/elements_object/create_tax_id_element)を参照してください。 ### Address Element とともに使用する (オプション) 納税者番号 Element を [Address Element](https://docs.stripe.com/elements/address-element.md) とともに使用すると、Stripe は顧客の住所に基づいて納税者番号の種類と Element の表示範囲を自動的に判別します。 ### 支払いを完了する 顧客が支払いフォームを送信したら、[confirmPayment](https://docs.stripe.com/js/payment_intents/confirm_payment) または [confirmSetup](https://docs.stripe.com/js/setup_intents/confirm_setup) を呼び出します。Stripe は納税者番号情報を自動的に含め、支払いが成功すると顧客に保存します。 ```javascript const form = document.getElementById('payment-form'); form.addEventListener('submit', async (event) => { event.preventDefault(); const {error} = await stripe.confirmPayment({ elements, confirmParams: { return_url: 'https://example.com/order/complete', }, }); if (error) { // Handle error console.error(error.message); } // Customer gets redirected to return_url if successful }); ``` また、クライアント側で [getValue](https://docs.stripe.com/js/elements_object/get_value_tax_id_element) を使用して、支払いを送信する前に納税者番号の値を読み取ることもできます。 ### 実装内容をテストする テスト環境では、サポートされている納税者番号タイプの正しい形式で英数字の文字列を入力できます (`eu_vat` の場合は `DE123456789` など)。納税者番号のサンプルの一覧については、Stripe の[顧客の納税者番号に関するガイド](https://docs.stripe.com/billing/customer/tax-ids.md#supported-tax-id)をご覧ください。また、[テスト用納税者番号](https://docs.stripe.com/connect/testing.md#test-business-tax-ids)を使用して、さまざまな確認ステータスのフローをテストすることもできます。 ### 納税者番号の検証 決済または設定の確認時に、Stripe は指定された納税者番号の形式が正しいことを確認しますが、有効かどうかは確認しません。顧客情報の有効性を確認する責任はお客様にあります。これを支援するため、Stripe は[オーストラリア事業者登録番号 (ABN)](https://docs.stripe.com/tax/invoicing/tax-ids.md#australian-business-numbers-abn)、[欧州付加価値税 (EU VAT)](https://docs.stripe.com/tax/invoicing/tax-ids.md#european-value-added-tax-eu-vat-numbers)、および[イギリス付加価値税 (GB VAT)](https://docs.stripe.com/tax/invoicing/tax-ids.md#united-kingdom-value-added-tax-gb-vat-numbers) の番号を政府のデータベースに対して非同期で自動的に照合します。Stripe が[実施する検証](https://docs.stripe.com/tax/invoicing/tax-ids.md#validation)と、これらのチェックのステータスの使用方法の詳細をご確認ください。 ### サポートされる納税番号の種類 納税者番号 Element は、次の国と地域での納税者番号回収をサポートしています。 | Country | Enum | Description | Example | Impact in Tax Calculation* | | ------- | ---------- | --------------------------------------------------------------------------- | -------------------- | -------------------------- | | AE | ae_trn | United Arab Emirates TRN | 123456789012345 | Yes | | AL | al_tin | Albania Tax Identification Number | J12345678N | Yes | | AM | am_tin | Armenia Tax Identification Number | 02538904 | Yes | | AO | ao_tin | Angola Tax Identification Number | 5123456789 | No | | AT | eu_vat | European VAT number | ATU12345678 | Yes | | AU | au_abn | Australian Business Number (AU ABN) | 12345678912 | Yes | | AW | aw_tin | Aruba Tax Identification Number | 12345678 | Yes | | AZ | az_tin | Azerbaijan Tax Identification Number | 0123456789 | Yes | | BA | ba_tin | Bosnia and Herzegovina Tax Identification Number | 123456789012 | Yes | | BB | bb_tin | Barbados Tax Identification Number | 1123456789012 | No | | BD | bd_bin | Bangladesh Business Identification Number | 123456789-0123 | Yes | | BE | eu_vat | European VAT number | BE0123456789 | Yes | | BF | bf_ifu | Burkina Faso Tax Identification Number (Numéro d'Identifiant Fiscal Unique) | 12345678A | Yes | | BG | eu_vat | European VAT number | BG0123456789 | Yes | | BH | bh_vat | Bahraini VAT Number | 123456789012345 | Yes | | BJ | bj_ifu | Benin Tax Identification Number (Identifiant Fiscal Unique) | 1234567890123 | Yes | | BS | bs_tin | Bahamas Tax Identification Number | 123.456.789 | No | | BY | by_tin | Belarus TIN Number | 123456789 | Yes | | CA | ca_bn | Canadian BN | 123456789 | No | | CA | ca_gst_hst | Canadian GST/HST number | 123456789RT0002 | Yes | | CA | ca_pst_bc | Canadian PST number (British Columbia) | PST-1234-5678 | No | | CA | ca_pst_mb | Canadian PST number (Manitoba) | 123456-7 | No | | CA | ca_pst_sk | Canadian PST number (Saskatchewan) | 1234567 | No | | CA | ca_qst | Canadian QST number (Québec) | 1234567890TQ1234 | Yes | | CD | cd_nif | Congo (DR) Tax Identification Number (Número de Identificação Fiscal) | A0123456M | No | | CH | ch_vat | Switzerland VAT number | CHE-123.456.789 MWST | Yes | | CL | cl_tin | Chilean TIN | 12.345.678-K | Yes | | CM | cm_niu | Cameroon Tax Identification Number (Numéro d'Identifiant fiscal Unique) | M123456789000L | No | | CR | cr_tin | Costa Rican tax ID | 1-234-567890 | No | | CV | cv_nif | Cape Verde Tax Identification Number (Número de Identificação Fiscal) | 213456789 | No | | CY | eu_vat | European VAT number | CY12345678Z | Yes | | CZ | eu_vat | European VAT number | CZ1234567890 | Yes | | DE | eu_vat | European VAT number | DE123456789 | Yes | | DK | eu_vat | European VAT number | DK12345678 | Yes | | EC | ec_ruc | Ecuadorian RUC number | 1234567890001 | No | | EE | eu_vat | European VAT number | EE123456789 | Yes | | EG | eg_tin | Egyptian Tax Identification Number | 123456789 | Yes | | ES | es_cif | Spanish NIF number (previously Spanish CIF number) | A12345678 | No | | ES | eu_vat | European VAT number | ESA1234567Z | Yes | | ET | et_tin | Ethiopia Tax Identification Number | 1234567890 | Yes | | FI | eu_vat | European VAT number | FI12345678 | Yes | | FR | eu_vat | European VAT number | FRAB123456789 | Yes | | GB | eu_vat | Northern Ireland VAT number | XI123456789 | Yes | | GB | gb_vat | United Kingdom VAT number | GB123456789 | Yes | | GE | ge_vat | Georgian VAT | 123456789 | Yes | | GN | gn_nif | Guinea Tax Identification Number (Número de Identificação Fiscal) | 123456789 | Yes | | GR | eu_vat | European VAT number | EL123456789 | Yes | | HR | eu_vat | European VAT number | HR12345678912 | Yes | | HU | eu_vat | European VAT number | HU12345678 | Yes | | HU | hu_tin | Hungary tax number (adószám) | 12345678-1-23 | No | | IE | eu_vat | European VAT number | IE1234567AB | Yes | | IN | in_gst | Indian GST number | 12ABCDE3456FGZH | Yes | | IS | is_vat | Icelandic VAT | 123456 | Yes | | IT | eu_vat | European VAT number | IT12345678912 | Yes | | KE | ke_pin | Kenya Revenue Authority Personal Identification Number | P000111111A | No | | KG | kg_tin | Kyrgyzstan Tax Identification Number | 12345678901234 | No | | KH | kh_tin | Cambodia Tax Identification Number | 1001-123456789 | Yes | | KR | kr_brn | Korean BRN | 123-45-67890 | Yes | | KZ | kz_bin | Kazakhstani Business Identification Number | 123456789012 | Yes | | LA | la_tin | Laos Tax Identification Number | 123456789-000 | No | | LI | li_vat | Liechtensteinian VAT number | 12345 | Yes | | LK | lk_vat | Sri Lanka VAT number | 123456789-1234 | Yes | | LT | eu_vat | European VAT number | LT123456789123 | Yes | | LU | eu_vat | European VAT number | LU12345678 | Yes | | LV | eu_vat | European VAT number | LV12345678912 | Yes | | MA | ma_vat | Morocco VAT Number | 12345678 | Yes | | MD | md_vat | Moldova VAT Number | 1234567 | Yes | | ME | me_pib | Montenegro PIB Number | 12345678 | No | | MK | mk_vat | North Macedonia VAT Number | MK1234567890123 | Yes | | MR | mr_nif | Mauritania Tax Identification Number (Número de Identificação Fiscal) | 12345678 | No | | MT | eu_vat | European VAT number | MT12345678 | Yes | | MX | mx_rfc | Mexican RFC number | ABC010203AB9 | No | | NG | ng_tin | Nigerian Tax Identification Number | 12345678-0001 | No | | NL | eu_vat | European VAT number | NL123456789B12 | Yes | | NO | no_vat | Norwegian VAT number | 123456789MVA | Yes | | NP | np_pan | Nepal PAN Number | 123456789 | Yes | | NZ | nz_gst | New Zealand GST number | 123456789 | Yes | | OM | om_vat | Omani VAT Number | OM1234567890 | Yes | | PE | pe_ruc | Peruvian RUC number | 12345678901 | Yes | | PH | ph_tin | Philippines Tax Identification Number | 123456789012 | Yes | | PL | eu_vat | European VAT number | PL1234567890 | Yes | | PL | pl_nip | Polish NIP number | 1234567890 | No | | PT | eu_vat | European VAT number | PT123456789 | Yes | | RO | eu_vat | European VAT number | RO1234567891 | Yes | | RS | rs_pib | Serbian PIB number | 123456789 | No | | RU | ru_inn | Russian INN | 1234567891 | Yes | | RU | ru_kpp | Russian KPP | 123456789 | Yes | | SA | sa_vat | Saudi Arabia VAT | 123456789012345 | Yes | | SE | eu_vat | European VAT number | SE123456789123 | Yes | | SG | sg_gst | Singaporean GST | M12345678X | Yes | | SI | eu_vat | European VAT number | SI12345678 | Yes | | SK | eu_vat | European VAT number | SK1234567891 | Yes | | SN | sn_ninea | Senegal NINEA Number | 12345672A2 | No | | SR | sr_fin | Suriname FIN Number | 1234567890 | Yes | | TH | th_vat | Thai VAT | 1234567891234 | Yes | | TJ | tj_tin | Tajikistan Tax Identification Number | 123456789 | Yes | | TR | tr_tin | Turkish Tax Identification Number | 0123456789 | Yes | | TW | tw_vat | Taiwanese VAT | 12345678 | Yes | | TZ | tz_vat | Tanzania VAT Number | 12345678A | Yes | | UA | ua_vat | Ukrainian VAT | 123456789 | Yes | | UG | ug_tin | Uganda Tax Identification Number | 1014751879 | Yes | | UY | uy_ruc | Uruguayan RUC number | 123456789012 | Yes | | UZ | uz_tin | Uzbekistan TIN Number | 123456789 | No | | UZ | uz_vat | Uzbekistan VAT Number | 123456789012 | Yes | | ZA | za_vat | South African VAT number | 4123456789 | Yes | | ZM | zm_tin | Zambia Tax Identification Number | 1004751879 | No | | ZW | zw_tin | Zimbabwe Tax Identification Number | 1234567890 | No | \*Stripe Tax won't apply tax if this tax ID is provided, in line with the relevant laws. ### 計算に ID を使用する (オプション) 国外へのサービスの提供など、顧客に[リバースチャージ](https://docs.stripe.com/tax/zero-tax.md#reverse-charges)に基づく税金の必要が生じる場合があります。税金を回収せず、代わりに「リバースチャージで支払われる税金」という文言を指定して請求書を発行する必要があります。 顧客の[納税者番号](https://docs.stripe.com/api/tax/calculations/create.md#calculate_tax-customer_details-tax_ids)をStripe Tax に提供すると、リバースチャージが適用される状況が自動的に判別されます。 ```curl curl https://api.stripe.com/v1/tax/calculations \ -u "<>:" \ -d currency=usd \ -d "line_items[0][amount]"=1000 \ -d "line_items[0][reference]"=L1 \ -d "customer_details[address][country]"=IE \ -d "customer_details[address_source]"=billing \ -d "customer_details[tax_ids][0][type]"=eu_vat \ -d "customer_details[tax_ids][0][value]"=DE123456789 ``` 無効な形式の納税者番号を指定すると、計算で `tax_id_invalid` エラーコードが返されます。 ## See also - [Connect で Stripe Tax を使用する](https://docs.stripe.com/tax/connect.md)