Applying Taxes to Subscriptions
Learn how to automatically charge tax on a subscription.
If you need to collect any type of tax on a subscription, such as VAT or sales tax, provide a tax_percent when creating the subscription. The value should be a decimal, with up to four decimal places, representing a percent (i.e., a 6.34% tax is set using 6.34). The calculated tax amount is rounded to the nearest unit (e.g., cents).
curl https://api.stripe.com/v1/subscriptions \
-u sk_test_BQokikJOvBiI2HlWgH4olfQ2: \
-d customer=cus_4fdAW5ftNQow1a \
-d items[0][plan]=pro-monthly \
-d tax_percent="6.34"
# Set your secret key: remember to change this to your live secret key in production
# See your keys here: https://dashboard.stripe.com/account/apikeys
Stripe.api_key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"
Stripe::Subscription.create(
:customer => "cus_4fdAW5ftNQow1a",
:items => [
{
:plan => "pro-monthly",
},
],
:tax_percent => 6.34,
)
# Set your secret key: remember to change this to your live secret key in production
# See your keys here: https://dashboard.stripe.com/account/apikeys
stripe.api_key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"
stripe.Subscription.create(
customer="cus_4fdAW5ftNQow1a",
items=[
{
"plan": "pro-monthly",
},
],
tax_percent=6.34,
)
// Set your secret key: remember to change this to your live secret key in production
// See your keys here: https://dashboard.stripe.com/account/apikeys
\Stripe\Stripe::setApiKey("sk_test_BQokikJOvBiI2HlWgH4olfQ2");
\Stripe\Subscription::create(array(
"customer" => "cus_4fdAW5ftNQow1a",
"items" => array(
array(
"plan" => "pro-monthly",
),
),
"tax_percent" => 6.34,
));
// Set your secret key: remember to change this to your live secret key in production
// See your keys here: https://dashboard.stripe.com/account/apikeys
Stripe.apiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2";
Map<String, Object> item = new HashMap<String, Object>();
item.put("plan", "pro-monthly");
Map<String, Object> items = new HashMap<String, Object>();
items.put("0", item);
Map<String, Object> params = new HashMap<String, Object>();
params.put("customer", "cus_4fdAW5ftNQow1a");
params.put("items", items);
params.put("tax_percent", 6.34);
Subscription subscription = Subscription.create(params);
// Set your secret key: remember to change this to your live secret key in production
// See your keys here: https://dashboard.stripe.com/account/apikeys
var stripe = require("stripe")("sk_test_BQokikJOvBiI2HlWgH4olfQ2");
stripe.subscriptions.create({
customer: "cus_4fdAW5ftNQow1a",
items: [
{
plan: "pro-monthly",
},
],
tax_percent: 6.34,
}, function(err, subscription) {
// asynchronously called
});
// Set your secret key: remember to change this to your live secret key in production
// See your keys here: https://dashboard.stripe.com/account/apikeys
stripe.Key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"
params := &stripe.SubParams{
Customer: "cus_4fdAW5ftNQow1a",
Items: []*stripe.SubItemsParams{
{
Plan: "pro-monthly",
},
},
TaxPercent: 6.34,
}
subscription, err := sub.New(params)
Taxes are automatically calculated on the invoice subtotal, factoring in any discounts or invoice items.
Sales tax laws vary by region and even by product or service. We recommend checking with a qualified accountant to identify your business’ requirements. To look up tax rates, or for more complex needs, consider using a third-party service that works with Stripe.
Next steps
Now that you understand how to charge taxes on subscriptions, you may want to check out: