Skip to content

Latest commit

 

History

History
88 lines (70 loc) · 19.5 KB

File metadata and controls

88 lines (70 loc) · 19.5 KB

TaxEstimation

Overview

Available Operations

estimate

The Estimate Tax API calculates the estimated tax for a specific transaction based on the provided details, including organization nexus, transaction details, customer details, and addresses. Optionally simulates nexus being met for tax calculation purposes. The simulate_nexus_met parameter is deprecated and will be removed in future releases.

Example Usage

from kintsugi_tax_platform_sdk import SDK, models
from kintsugi_tax_platform_sdk.utils import parse_datetime


with SDK(
    security=models.Security(
        api_key_header="<YOUR_API_KEY_HERE>",
        custom_header="<YOUR_API_KEY_HERE>",
    ),
) as sdk:

    res = sdk.tax_estimation.estimate(date_=parse_datetime("2025-01-23T13:01:29.949Z"), external_id="txn_12345", currency=models.CurrencyEnum.USD, transaction_items=[
        {
            "external_id": "item_A",
            "date_": parse_datetime("2024-10-28T10:00:00Z"),
            "external_product_id": "prod_abc",
            "quantity": 2,
            "amount": 100,
        },
        {
            "external_id": "item_B",
            "date_": parse_datetime("2024-10-28T10:00:00Z"),
            "external_product_id": "prod_xyz",
            "amount": 75.5,
        },
    ], addresses=[
        {
            "type": models.TransactionEstimatePublicRequestType.SHIP_TO,
            "street_1": "789 Pine St",
            "city": "Austin",
            "state": "TX",
            "postal_code": "78701",
            "country": "US",
        },
    ], marketplace=False)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
date_ date ✔️ The date of the transaction in ISO 8601 format (e.g., 2025-01-25T12:00:00Z).
external_id str ✔️ Unique identifier of this transaction in the source system.
currency models.CurrencyEnum ✔️ N/A
transaction_items List[models.TransactionItemEstimateBase] ✔️ List of items involved in the transaction.
addresses List[models.TransactionEstimatePublicRequestAddress] ✔️ List of addresses related to the transaction. At least one BILL_TO or SHIP_TO address must be provided. The address will be validated during estimation, and the transaction may be rejected if the address does not pass validation. The SHIP_TO will be preferred to use for determining tax liability.
simulate_nexus_met Optional[bool] : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated: Use simulate_active_registration in the request body instead.
description Optional[str] An optional description of the transaction.
source Optional[models.SourceEnum] N/A
marketplace Optional[bool] Indicates if the transaction involves a marketplace.
customer Optional[models.CustomerBasePublic] N/A
total_amount Optional[float] : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Total amount of the transaction. Deprecated - computed from transaction_items. Optional for backward compatibility.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.PageTransactionEstimateResponse

Errors

Error Type Status Code Content Type
errors.ErrorResponse 401 application/json
errors.BackendSrcTaxEstimationResponsesValidationErrorResponse 422 application/json
errors.ErrorResponse 500 application/json
errors.APIError 4XX, 5XX */*