From b08df5568a787b67c5900afe3093eb4f9f9625ee Mon Sep 17 00:00:00 2001 From: "juancarlos.cavero" Date: Thu, 10 Sep 2026 18:25:52 +0200 Subject: [PATCH] fix(billing): collect the customer's VAT and legal name at checkout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A company that pays for OpenShorts is never asked for its fiscal data: the Checkout Session carried no `tax_id_collection`, and `ensure_stripe_customer` creates the customer with an e-mail and nothing else. So every B2B invoice goes out addressed to an e-mail address, and the buyer writes to support asking for a corrected one (ticket #4520) — which cannot be done in place, because the invoice is issued and its customer data frozen, so it takes a rectificativa in the accounting. `customer_update.name` is what makes Checkout save the collected name onto an EXISTING customer, and we always pass one, so without it the tax ID would land while the name stayed empty. Not `required`: the form only shows in supported countries and forcing it adds a field to a funnel that already converts at ~1%. Claude-Session: https://claude.ai/code/session_01HmESVgJzPkP3LuUB6fmRL3 --- cloud/billing.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cloud/billing.py b/cloud/billing.py index 46fed76..3110f57 100644 --- a/cloud/billing.py +++ b/cloud/billing.py @@ -182,6 +182,20 @@ async def create_checkout(body: CheckoutRequest, request: Request): success_url=f"{fe}/#/account?checkout=success", cancel_url=f"{fe}/#/pricing?checkout=cancel", allow_promotion_codes=True, + # Business customers need their legal name and VAT on the invoice to + # deduct the tax, and this is the only place they can ever type them: + # nothing in the dashboard asks for fiscal data. Without it every + # company is invoiced as an anonymous e-mail address and writes to + # support asking for a corrected invoice (ticket #4520), which cannot + # be done in place — the invoice is already issued and its customer + # data frozen, so it takes a rectificativa in the accounting. + # ``customer_update.name`` is required for Checkout to save the name + # onto an EXISTING customer (we always pass one); ``address`` saves the + # billing address the same way. Not made ``required``: it is shown only + # in supported countries and forcing it would add a field to a funnel + # that already converts at ~1%. + tax_id_collection={"enabled": True}, + customer_update={"name": "auto", "address": "auto"}, metadata={ "user_id": str(user.id), "kind": entry["kind"],