# Create a Calculation

Calculates tax based on the input and returns a Tax `Calculation` object.

## Request

```curl
curl https://api.stripe.com/v1/tax/calculations \
  -u "<<YOUR_SECRET_KEY>>" \
  -d currency=usd \
  -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 "line_items[0][amount]=1499" \
  -d "line_items[0][tax_code]=txcd_10000000" \
  -d "line_items[0][reference]=Music Streaming Coupon" \
  -d "shipping_cost[amount]=300" \
  -d "expand[0]=line_items"
```

### Response

```json
{
  "id": "taxcalc_1OduxkBUZ691iUZ4iWvpMApI",
  "object": "tax.calculation",
  "amount_total": 1953,
  "currency": "usd",
  "customer": null,
  "customer_details": {
    "address": {
      "city": "Seattle",
      "country": "US",
      "line1": "920 5th Ave",
      "line2": null,
      "postal_code": "98104",
      "state": "WA"
    },
    "address_source": "shipping",
    "ip_address": null,
    "tax_ids": [],
    "taxability_override": "none"
  },
  "expires_at": 1706708005,
  "line_items": {
    "object": "list",
    "data": [
      {
        "id": "tax_li_PSqf3RMNZa23H4",
        "object": "tax.calculation_line_item",
        "amount": 1499,
        "amount_tax": 154,
        "livemode": false,
        "product": null,
        "quantity": 1,
        "reference": "Music Streaming Coupon",
        "tax_behavior": "exclusive",
        "tax_code": "txcd_10000000"
      }
    ],
    "has_more": false,
    "total_count": 1,
    "url": "/v1/tax/calculations/taxcalc_1OduxkBUZ691iUZ4iWvpMApI/line_items"
  },
  "livemode": false,
  "ship_from_details": null,
  "shipping_cost": {
    "amount": 300,
    "amount_tax": 0,
    "tax_behavior": "exclusive",
    "tax_code": "txcd_92010001"
  },
  "tax_amount_exclusive": 154,
  "tax_amount_inclusive": 0,
  "tax_breakdown": [
    {
      "amount": 154,
      "inclusive": false,
      "tax_rate_details": {
        "country": "US",
        "percentage_decimal": "10.25",
        "state": "WA",
        "tax_type": "sales_tax"
      },
      "taxability_reason": "standard_rated",
      "taxable_amount": 1499
    },
    {
      "amount": 0,
      "inclusive": false,
      "tax_rate_details": {
        "country": "DE",
        "percentage_decimal": "0.0",
        "state": null,
        "tax_type": "vat"
      },
      "taxability_reason": "zero_rated",
      "taxable_amount": 300
    }
  ],
  "tax_date": 1706535204
}
```

## Returns

A Tax `Calculation` object containing the first 100 input `line_items` if the calculation succeeds. Otherwise, an error (for example, indicating that the customer address was invalid).

## Parameters

- `currency` (enum, required)
  Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://docs.stripe.com/currencies.md).

- [`line_items`](https://docs.stripe.com/api/tax/calculations/create.md?query=line_items) (array of objects, required)
  A list of items the customer is purchasing.

- `customer` (string, required unless customer_details provided)
  The ID of an existing customer to use for this calculation. If provided, the customer’s address and tax IDs are copied to `customer_details`.

- [`customer_details`](https://docs.stripe.com/api/tax/calculations/create.md?query=customer_details) (object, required unless customer provided)
  Details about the customer, including address and tax IDs.

- [`ship_from_details`](https://docs.stripe.com/api/tax/calculations/create.md?query=ship_from_details) (object, optional)
  Details about the address from which the goods are being shipped.

- [`shipping_cost`](https://docs.stripe.com/api/tax/calculations/create.md?query=shipping_cost) (object, optional)
  Shipping cost details to be used for the calculation.

- `tax_date` (integer, optional)
  The calculation uses the tax rules and rates that are in effect at this timestamp. You can use a date up to 31 days in the past or up to 31 days in the future. If you use a future date, Stripe doesn’t guarantee that the expected tax rules and rate being used match the actual rules and rate that will be in effect on that date. We deploy tax changes before their effective date, but not within a fixed window.
