Skip to content
Create account
or
Sign in
The Stripe Docs logo
/
Ask AI
Create account
Sign in
Get started
Payments
Finance automation
Platforms and marketplaces
Money management
Developer tools
Get started
Payments
Finance automation
Get started
Payments
Finance automation
Platforms and marketplaces
Money management
Overview
About Stripe payments
Upgrade your integration
Payments analytics
Online payments
OverviewFind your use caseManaged Payments
Use Payment Links
Build a checkout page
    Overview
    Quickstarts
    Customize look and feel
    Collect additional information
    Collect taxes
      Use manual tax rates
      Collect tax IDs
    Dynamically update checkout
    Manage your product catalog
    Subscriptions
    Manage payment methods
    Let customers pay in their local currency
    Add discounts, upsells, and optional items
    Set up future payments
    Save payment details during payment
    Manually approve payments on your server
    After the payment
    Elements with Checkout Sessions API beta changelog
    Migrate from legacy Checkout
    Migrate Checkout to use Prices
Build an advanced integration
Build an in-app integration
Payment methods
Add payment methods
Manage payment methods
Faster checkout with Link
Payment interfaces
Payment Links
Checkout
Web Elements
In-app Elements
Payment scenarios
Custom payment flows
Flexible acquiring
Orchestration
In-person payments
Terminal
Other Stripe products
Financial Connections
Crypto
Climate
HomePaymentsBuild a checkout page

Collect taxes

Learn how to collect taxes with Stripe Tax.

Copy page

Stripe Tax is a paid product that automatically calculates the tax on your transactions without the need to define the rates and rules. Fees only apply after you’ve added at least one location where you’re registered to calculate and remit tax.

Configure your Checkout Session to collect tax

To start collecting tax:

  1. Pass automatic_tax[enabled]=true.
  2. Specify a tax_code for each line item or set a preset tax code in the Dashboard.
  3. Specify a tax_behavior for each line item or set a default tax behavior in the Dashboard.
Command Line
cURL
curl https://api.stripe.com/v1/checkout/sessions \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d "line_items[0][price_data][currency]"=usd \ -d "line_items[0][price_data][product_data][name]"=T-shirt \ -d "line_items[0][price_data][product_data][tax_code]"=txcd_99999999 \ -d "line_items[0][price_data][unit_amount]"=2000 \ -d "line_items[0][price_data][tax_behavior]"=exclusive \ -d "line_items[0][quantity]"=1 \ -d mode=payment \ -d ui_mode=custom \ -d return_url={{RETURN_URL}} \ -d "automatic_tax[enabled]"=true

Tax codes

Tax codes associate products with tax rates. Choose the tax code that best fits your product from the list of available tax codes. If a product doesn’t fit any of the specific codes, use one of the codes with “General” in its name.

Tax behavior

The tax behavior determines how tax is presented to the buyer. There are two options for tax behavior:

  • Exclusive: The product price doesn’t include tax. Tax is added as a separate amount.
  • Inclusive: The product price includes any tax amount.

Learn more about tax behavior.

OptionalCheck the response

Render tax amount

Use useCheckout to render the tax amount in your checkout form. Make sure you understand the difference between inclusive and exclusive tax.

import React from 'react'; import {useCheckout} from '@stripe/react-stripe-js'; const CheckoutForm = () => { const checkout = useCheckout(); return ( <div> <h2>Checkout Summary</h2> <pre> {JSON.stringify(checkout.lineItems, null, 2)} </pre> <h3>Totals</h3> <pre> Subtotal: {checkout.total.subtotal.amount} {/* Make sure you are using the appropriate tax amount type (taxInclusive and/or taxExclusive) for your integration */} Tax: {checkout.total.taxExclusive.amount} Total: {checkout.total.total.amount} </pre> </div> ) };
Was this page helpful?
YesNo
Need help? Contact Support.
Join our early access program.
Check out our changelog.
Questions? Contact Sales.
LLM? Read llms.txt.
Powered by Markdoc