# Stripe 外の決済で税金を徴収する Stripe Tax API を使用して、Stripe 外で処理された決済の税金を計算しレポートします。 Stripe Tax API を使用して、Stripe 外で処理した決済の税金を計算してレポートします。サードパーティーの決済代行業者や、自社内の決済システム、請求システムに対応しています。 > #### 決済のために Stripe を利用していますか? > > Stripe で決済を処理している場合は、代わりに以下の連携をご検討ください。 > > - 税務トランザクションの自動管理には [Stripe Tax と PaymentIntents](https://docs.stripe.com/tax/payment-intent.md) - 組み込みの税務サポートには、[Checkout での Stripe Tax](https://docs.stripe.com/tax/checkout.md)、[Invoicing](https://docs.stripe.com/tax/invoicing.md)、または [Subscriptions](https://docs.stripe.com/tax/subscriptions.md) ## 登録を追加する Stripe Tax は、税金徴収の登録をしている管轄区域でのみ税金を計算します。ダッシュボードで [登録を追加](https://docs.stripe.com/tax/registering.md#add-a-registration) する必要があります。 ## Optional: 顧客住所を収集する [サーバー側] 通常、徴収する税金は顧客の所在地によって異なります。より正確な税額計算のために、顧客の完全な住所を収集してください。住所の収集前に、[IP アドレス](https://docs.stripe.com/tax/standalone-tax-api.md#ip-address)に基づく見積もりを顧客に表示できます。 税金を計算するために必要な住所情報は、[顧客の国](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/standalone-tax-api.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) | 税金計算後の合計金額です。顧客への請求金額としてご使用ください。 | | [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" } } ``` このエラーを受け取った場合は、顧客に入力した住所を確認し、入力ミスを修正するように求めます。 ## 税務トランザクションを作成する [サーバー側] 税取引を作成すると、顧客から徴収した税金が記録されるため、後でエクスポートをダウンロードして、[納税申告に役立つレポートを生成できます](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` を指定する必要があります。この参照番号は、税金のエクスポート結果に表示され、徴収した税金をシステムの注文と照合するのに役立ちます。 例えば、参照番号 `order_123456789`、項目参照番号 `L1` と `L2`、および送料を含む税務トランザクションは、明細税務エクスポートで次のように表示されます。 | ID | line_item_id | タイプ | 通貨 | transaction_date | | --------------- | ------------ | -------- | --- | ------------------- | | order_123456789 | L1 | external | usd | 2023-02-23 17:01:16 | | order_123456789 | L2 | external | usd | 2023-02-23 17:01:16 | | order_123456789 | shipping | external | usd | 2023-02-23 17:01:16 | 顧客が決済を行う際、計算 ID を使用して徴収した税金を記録します。税務トランザクションは、システムで決済が正常に処理された後 (例: 注文送信エンドポイント、または決済代行業者からの決済成功コールバックへの応答時) に作成できます。 以下の例では、トランザクションを作成し、一意の注文または決済参照番号を使用します。 ```curl curl https://api.stripe.com/v1/tax/transactions/create_from_calculation \ -u "<>:" \ -d calculation={{TAX_CALCULATION}} \ -d reference=order_12345 \ -d "expand[]=line_items" ``` 後で返金を記録できるよう、[税務トランザクション ID](https://docs.stripe.com/api/tax/transactions/object.md#tax_transaction_object-id) を保存してください。トランザクション ID は、紐付く注文と合わせてデータベースに保存できます。 ## 返金を記録する [サーバー側] 顧客への売上を記録するために税取引を作成した後で、返金の記録が必要になる場合があります。これらは、`type=reversal` の税取引としても表されます。差戻し取引は、逆の符合の金額を指定することで前の取引を相殺します。たとえば、50 USD の売上を記録した取引に、後から -50 USD の全額差戻しを指定できます。 返金する場合、一意の`参照番号`を使用して差戻し税務トランザクションを作成する必要があります。一般的な方法には次のものがあります。 - 元の参照番号にサフィックスを付加します。例えば、元のトランザクションの参照番号が `order_123456789` の場合、参照番号 `order_123456789-refund` で差戻しトランザクションを作成します。 - システムの返金 ID を使用します。例: `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=order_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": "order_123456789-cancel", "reversal": { "original_transaction": "tax_1MEFAAI6rIcR421eB1YOzACZ" }, "shipping_cost": null, "tax_date": 1670863654, "type": "reversal" } ``` トランザクションを完全に差戻しても、以前の部分的な差戻しには影響しません。完全な差戻しを記録する場合、重複した返金を避けるため、同一トランザクションに対する以前の部分的な差戻しをすべて[完全に差戻す](https://docs.stripe.com/tax/off-stripe.md#reversals-void-refund)必要があります。 ### 売上を一部返金する 顧客への返金後、`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=order_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 order_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 order_123456789 (customer was unhappy)" }, "reference": "order_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/off-stripe.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=order_234567890-refund_1 \ -d flat_amount=-1650 \ -d "metadata[refund]={{REFUND_ID}}" \ --data-urlencode "metadata[refund_reason]=Refunded 16.50 USD of order_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 order_234567890 (customer was unhappy)" }, "reference": "order_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=order_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 order_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=order_234567890-refund_2 \ -d flat_amount=-1650 \ -d "metadata[refund]={{REFUND_ID}}" \ --data-urlencode "metadata[refund_reason]=Refunded 16.50 USD of order_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": "order_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) を作成することで一部返金をキャンセルできます。 この処理が必要になる状況を以下に示します。 - 決済の返金が失敗し、顧客に商品またはサービスが提供されていない場合 - 誤った注文が返金されたか、誤った金額が返金された場合 - 元の売上が全額返金され、一部返金が無効になった場合 以下の例の `tax_1MEFACI6rIcR421eHrjXCSmD` は一部返金を表す取引です。 ```curl curl https://api.stripe.com/v1/tax/transactions/create_reversal \ -u "<>:" \ -d mode=full \ -d original_transaction=tax_1MEFACI6rIcR421eHrjXCSmD \ -d reference=order_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": "order_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/off-stripe.md#tax-transaction) が作成されていることを確認してください。 配送料、内税価格、IP アドレスの推定などの詳細オプションについては、[スタンドアロン Tax の API リファレンス](https://docs.stripe.com/tax/standalone-tax-api.md)をご覧ください。 ## See also - [スタンドアロン Tax API](https://docs.stripe.com/tax/standalone-tax-api.md) - [シンプルな Stripe Tax API](https://docs.stripe.com/tax/payment-intent/simplified.md) - [Stripe Tax API、カスタム](https://docs.stripe.com/tax/payment-intent/custom.md) - [税務連携のテスト](https://docs.stripe.com/tax/testing.md) - [レポートと申告](https://docs.stripe.com/tax/reports.md)