By: Tom Sydney Kerckhove <syd@cs-syd.eu>
Read a charge's tax off its invoice or its checkout session nix-ci sells subscriptions through checkout, so the money arrives as subscription invoices, but a one-off sale through a payment link or a checkout page produces a charge with no invoice at all and the session is the only object that records its tax. So tax evidence is now a notion in its own right, satisfied by either. The link runs from the charge outwards rather than inwards. Balance transactions expand their source, and the charge names both the invoice it was billed through and the payment intent it shares with its session. Matching the other way, from invoice.charge, misses every charge whose invoice is gone and every charge that never had one: of 105 charges in the sandbox, 8 name an invoice and 97 name only a payment intent, and 5 of the 13 surviving invoices name no charge at all. A key without the checkout session permission gets a warning and an empty index rather than a failure, so an account that only bills through invoices need not grant it. Nothing is mis-booked by that: a charge that needed a session and did not get one is refused by name. Two test-quality fixes, both found by mutating the fee booking and watching the property not care. The generator produced refunds, wrong-signed payouts and currency codes that are not currency symbols, all of which aggregation refuses, and a refusal satisfies a property without testing anything. And the balance property compared against the balance overall while generated dates fell outside the import window; it compares against the last month booked now.