Weiter zum Inhalt
Konto erstellen oder anmelden
Das Logo der Stripe-Dokumentation
/
KI fragen
Konto erstellenAnmelden
Jetzt starten
Zahlungen
Umsatz
Plattformen und Marktplätze
Geldmanagement
Entwicklerressourcen
APIs und SDKsHilfe
Übersicht
Informationen zu Stripe Payments
Aktualisieren Sie Ihre Integration
Zahlungsanalysefunktionen
Online-Zahlungen
ÜbersichtIhren Use case findenVerwenden Sie Managed Payments
Payment Links verwenden
Vorgefertigte Checkout-Seite verwenden
Erstellen Sie eine benutzerdefinierte Integration mit Elements
    Übersicht
    QuickStart-Leitfäden
    Stripe Elements
    Vergleichen Sie Checkout-Sitzungen und PaymentIntents
    Erweiterte Integration entwerfen
    Erscheinungsbild anpassen
    Zahlungsmethoden verwalten
    Zusätzliche Informationen erfassen
    Abonnement-Integration erstellen
    Dynamische Aktualisierungen
    Rabatte hinzufügen
    Steuern auf Ihre Zahlungen einziehen
      Steuer-IDs erfassen
    Gutschriften einlösen
    Lassen Sie Kundinnen/Kunden in ihrer Landeswährung zahlen
    Zahlungsmethoden von Kundinnen und Kunden speichern und abrufen
    Belege und bezahlte Rechnungen senden
    Zahlungen auf Ihrem Server manuell genehmigen
    Eine Zahlung separat autorisieren und einziehen
    Elements mit Checkout Sessions API-Änderungsprotokoll (Beta)
In-App-Integration erstellen
Präsenzzahlungen
Terminal
Zahlungsmethoden
Zahlungsmethoden hinzufügen
Zahlungsmethoden verwalten
Schnellerer Bezahlvorgang mit Link
Zahlungsszenarien
Umgang mit mehreren Währungen
Nutzerdefinierte Zahlungsabläufe
Flexibles Acquiring
Orchestrierung
Mehr als Zahlungen
Unternehmensgründung
Krypto
Agentenbasierter Handel
Financial Connections
Climate
Betrug verstehen
Betrugsprävention von Radar
Zahlungsanfechtungen verwalten
Identitäten verifizieren
Vereinigte Staaten
Deutsch
StartseiteZahlungenBuild a custom integration with Elements

Notiz

Bis jetzt ist diese Seite noch nicht in dieser Sprache verfügbar. Wir arbeiten aber verstärkt daran, unsere Dokumentation in weiteren Sprachen bereitzustellen, und werden die Übersetzung sofort anzeigen, sobald diese verfügbar ist.

Collect taxes

Learn how to use Stripe Tax to calculate and collect taxes in your custom integration with Elements.

Use Stripe Tax to automatically calculate the tax on your transactions without requiring you to define the rates and rules. Fees only apply after you add 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 when creating a Checkout Session.
  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.

This code enables automatic tax calculation using Stripe Tax, a tax code, and a tax behavior. Stripe Tax then uses the tax code and tax behavior to automatically calculate taxes.

Command Line
cURL
Stripe CLI
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
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

The tax codes associate products with tax rates. Choose the appropriate tax code for your product from the list of tax codes. If a product doesn’t match with any of the tax codes, you can use one of the General codes.

Tax behavior

The tax behavior determines how to present tax to the customer:

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

OptionalCollect tax through the Payment Element

You can collect tax address details directly in the Payment Element. Collecting tax address details through the Payment Element is suitable for the following use cases:

  • You don’t require full address collection.
  • You only require address collection for tax collection purposes.

This feature integrates input fields for the country and postal code into each payment method form within the Payment Element. It only collects the minimum required address fields for tax calculation based on Stripe Tax requirements.

There are certain regional considerations where the tax rate using the minimum required address fields might differ from the tax rate at your customer’s full address. We recommend using the Address Element to collect your customer’s full address for tax calculation if these regional considerations apply to your business.

When you create the Checkout Session, set billing_address_collection=auto to automatically collect the billing address.

Don’t include the shipping_address_collection parameter. If you provide this parameter, tax address details are collected based on the shipping address instead of the billing address.

Command Line
cURL
Stripe CLI
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
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 \ -d billing_address_collection=auto

When collecting tax address details through the Payment Element, tax calculation behaves as follows for the following scenarios:

  • If you pass fields.billingDetails.address=auto | if_required, the Payment Element collects the minimum required address fields for tax calculation.
  • If you pass fields.billingDetails.address=never, you must collect tax address details through an alternative method because the billing input fields won’t show in the Payment Element.
  • If you pass fields.billingDetails.address.country=never, the customer’s detected country is used for tax calculation.
  • If you pass fields.billingDetails.address.postalCode=never, the method returns an error because the postal code might be required for certain countries.
  • If you call action.updateBillingAddress, the method returns an error because the billing address could potentially conflict.

OptionalCheck the response

You can view the calculated tax amount for each payment as follows:

  • In the Checkout Session resource, review the total_details.amount_tax property.
  • In the Dashboard, review the tax outcome for each payment.

Render the tax amount

Use the useCheckout hook to display the tax amount in your payment form.

import React from 'react'; import {useCheckout} from '@stripe/react-stripe-js'; const CheckoutForm = () => { const checkoutState = useCheckout(); if (checkoutState.type === 'loading') { return ( <div>Loading...</div> ); } else if (checkoutState.type === 'error') { return ( <div>Error: {checkoutState.error.message}</div> ); } const {checkout} = checkoutState; 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 use the appropriate tax amount type (taxInclusive and/or taxExclusive) for your integration */} Tax: {checkout.total.taxExclusive.amount} Total: {checkout.total.total.amount} </pre> </div> ) };
War diese Seite hilfreich?
JaNein
  • Benötigen Sie Hilfe? Kontaktieren Sie den Kundensupport.
  • Schauen Sie sich unser Änderungsprotokoll an.
  • Fragen? Sales-Team kontaktieren.
  • LLM? Lesen Sie llms.txt.
  • Unterstützt von Markdoc