## Calculate tax in custom payment flows

The Stripe Tax API enables you to calculate tax in your custom payment flows. If you use the Payment Intents API, Stripe can submit tax transactions in the payment lifecycle.

### Choose the right tax integration

Stripe offers two ways to handle tax in custom payment flows. Choose based on how much control you need over tax reversals:

*   **Use the Payment Intents integration** if you want Stripe to handle tax transactions and reversals automatically, and if flat-amount refund reversals meet your needs.
*   **Use the custom tax API** if you need line-item level control over tax reversals (for example, refunding specific items), work with multiple payment processors, or need full control over when transactions are recorded.

### Calculate tax

Calculating tax typically requires your customer’s location. You can:

*   Use the Address Element to take advantage of autocomplete and localization features to collect your customer’s full address. This helps ensure the most accurate tax calculation.
*   Estimate tax based on the customer’s IP address.
*   Collect address details using your own custom form.

Pass the transaction details and customer address information to the calculate tax API to get a new Tax Calculation object.

```curl
curl https://api.stripe.com/v1/tax/calculations \
  -u "sk_test_RXHltS2OKzISvxWQ7NmRN57i001oa6x7o4:" \
  -d currency=usd \
  -d "line_items[0][amount]=1000" \
  -d "line_items[0][reference]=L1" \
```