From 936f5ddb01d109e1bf17a48338497ae44af8e54a Mon Sep 17 00:00:00 2001 From: Jamil Date: Mon, 31 Mar 2025 06:23:39 -0700 Subject: [PATCH] chore(billing): Enable automatic tax calculation by default (#8552) When a customer signs up for Starter or Team, we don't enable tax calculation by default. This means customers can upgrade to Team, start paying invoices, and we won't collect taxes. This creates a management issue and possible tax liability since I need to manually reconcile these. Instead, since we have Stripe Tax configured on our account, we can enable automatic tax calculation when the subscription is created. Any products (Starter/Team/Enterprise) therefore in the subscription will automatically collect tax appropriately. In most cases in the US, the tax rate is 0. In EU transactions, for B2B sales, the tax rate for us is also 0 (reverse charge basis). If we sell a Team subscription to an individual, however, we need to collect VAT. There doesn't seem to be a way to block consumer EU transactions in Stripe, so we'll likely need to register for VAT in the EU if we cross the reporting threshold. --- elixir/apps/domain/lib/domain/billing/stripe/api_client.ex | 1 + elixir/apps/domain/test/domain/billing_test.exs | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/elixir/apps/domain/lib/domain/billing/stripe/api_client.ex b/elixir/apps/domain/lib/domain/billing/stripe/api_client.ex index d9e227208..2608ccc0b 100644 --- a/elixir/apps/domain/lib/domain/billing/stripe/api_client.ex +++ b/elixir/apps/domain/lib/domain/billing/stripe/api_client.ex @@ -93,6 +93,7 @@ defmodule Domain.Billing.Stripe.APIClient do URI.encode_query( %{ "customer" => customer_id, + "automatic_tax[enabled]" => true, "items[0][price]" => price_id }, :www_form diff --git a/elixir/apps/domain/test/domain/billing_test.exs b/elixir/apps/domain/test/domain/billing_test.exs index fdc9e333d..c0fa6d6e7 100644 --- a/elixir/apps/domain/test/domain/billing_test.exs +++ b/elixir/apps/domain/test/domain/billing_test.exs @@ -560,7 +560,8 @@ defmodule Domain.BillingTest do assert params == %{ "customer" => customer_id, - "items" => %{"0" => %{"price" => "price_1OkUIcADeNU9NGxvTNA4PPq6"}} + "items" => %{"0" => %{"price" => "price_1OkUIcADeNU9NGxvTNA4PPq6"}}, + "automatic_tax" => %{"enabled" => "true"} } end @@ -695,7 +696,8 @@ defmodule Domain.BillingTest do assert params == %{ "customer" => customer_id, - "items" => %{"0" => %{"price" => "price_1OkUIcADeNU9NGxvTNA4PPq6"}} + "items" => %{"0" => %{"price" => "price_1OkUIcADeNU9NGxvTNA4PPq6"}}, + "automatic_tax" => %{"enabled" => "true"} } end