<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: 付小花</title>
    <description>The latest articles on DEV Community by 付小花 (@fuxiaohua).</description>
    <link>https://dev.to/fuxiaohua</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3995049%2F8c9ee398-b015-476b-a498-84d597ff06ca.jpg</url>
      <title>DEV Community: 付小花</title>
      <link>https://dev.to/fuxiaohua</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fuxiaohua"/>
    <language>en</language>
    <item>
      <title>A 3PL invoice is a spreadsheet of promises nobody re-reads — here is the cross-check I coded</title>
      <dc:creator>付小花</dc:creator>
      <pubDate>Mon, 09 Nov 2026 07:50:51 +0000</pubDate>
      <link>https://dev.to/fuxiaohua/a-3pl-invoice-is-a-spreadsheet-of-promises-nobody-re-reads-here-is-the-cross-check-i-coded-4kcl</link>
      <guid>https://dev.to/fuxiaohua/a-3pl-invoice-is-a-spreadsheet-of-promises-nobody-re-reads-here-is-the-cross-check-i-coded-4kcl</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;读数来源＝Provenance for the numbers below: every figure is either the tool's own built-in&lt;br&gt;
sample data (our source, &lt;code&gt;src/lib/threepl/rules.ts&lt;/code&gt;) or a string that our own page rendered in&lt;br&gt;
a real browser after deployment. &lt;strong&gt;No customer invoice is quoted here, and no customer result&lt;br&gt;
is claimed.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Every small brand that ships through a third-party logistics warehouse eventually gets that&lt;br&gt;
invoice: a CSV with 400 rows of fees, most of them familiar, a few of them new, and a total&lt;br&gt;
that is 6% higher than last month. Nobody argues with it. Not because the charges are&lt;br&gt;
defensible, but because arguing requires holding a signed rate card, an order export, and&lt;br&gt;
400 invoice lines in your head at the same time.&lt;/p&gt;

&lt;p&gt;I built a checker for exactly that gap. It is free, it runs entirely in the browser, and it&lt;br&gt;
does one job: compare what a 3PL billed you, line by line, against what your contracted rate&lt;br&gt;
card says you agreed to pay. This post is about how the comparison works and the four things&lt;br&gt;
that broke while building it.&lt;/p&gt;
&lt;h2&gt;
  
  
  What "overcharge" actually means in a 3PL invoice
&lt;/h2&gt;

&lt;p&gt;Oversize surcharges, pick-and-pack fees, storage days, fuel add-ons, receiving fees, the&lt;br&gt;
"manual handling" line that appears only some months. Almost all of it is legitimate — when it&lt;br&gt;
matches the card. The expensive part is not fraud, it is drift:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the card says $4.10 per unit for a standard pick, the invoice says $4.55 for the same SKU class&lt;/li&gt;
&lt;li&gt;a fee appears that is not on the card at all (this is the one everyone misses, because the
line looks like the other 399 lines)&lt;/li&gt;
&lt;li&gt;a surcharge is applied to a shipment the contract excludes (e.g. the card says fuel is waived
below 2 lb, the invoice applies it to a 1.8 lb order)&lt;/li&gt;
&lt;li&gt;the quantity billed does not match the quantity shipped&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of those require a lawyer. They require a diff. That is the whole product insight: &lt;strong&gt;the&lt;br&gt;
dispute is a join between three tables, and nobody has time to do the join by hand.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  The four rules I coded
&lt;/h2&gt;

&lt;p&gt;The checker takes three inputs, all pasted or dropped in as CSV: the invoice lines, the rate&lt;br&gt;
card entries, and your order/shipment export. For each billed line it resolves the applicable&lt;br&gt;
card entry (same service, same weight or size band, effective date in range) and then runs:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Rule A — unlisted fee.&lt;/strong&gt; The invoice has a fee description that no card entry covers.
Verdict: &lt;em&gt;flag, ask for the contractual basis.&lt;/em&gt; This one carries no dollar amount to compare
against, so it must never be silently priced.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rule B — unit-rate mismatch.&lt;/strong&gt; Billed unit rate ≠ card unit rate for the matched band.
The delta is &lt;code&gt;(billed_rate - card_rate) × billed_quantity&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rule C — quantity or band mismatch.&lt;/strong&gt; The rate is right but the count is not, or the
shipment is billed in a band its own weight/size does not fall into. The delta is
&lt;code&gt;(billed_qty - shipped_qty) × card_rate&lt;/code&gt;, and the second half is checked against your
shipment export rather than against the invoice.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rule D — no card match and no order match.&lt;/strong&gt; Not an error, a &lt;em&gt;question&lt;/em&gt;. These lines go to a
"needs confirmation" bucket so the tool never invents a number for something it cannot see.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The output is three lists: clean lines, disputed lines with a dollar delta each, and the&lt;br&gt;
confirmation bucket. The disputed total is just the sum of the deltas — the number you put at&lt;br&gt;
the top of the email.&lt;/p&gt;
&lt;h2&gt;
  
  
  A worked example (sample data, not a real bill)
&lt;/h2&gt;

&lt;p&gt;The built-in example is four invoice lines against a card where standard pick is $4.10/unit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;line 1  pick-and-pack   100 units   billed $410.00   card $4.10   -&amp;gt; clean
line 2  pick-and-pack    40 units   billed $182.00   card $4.10   -&amp;gt; Rule B, delta $18.00
line 3  oversize surcharge           billed $124.65   card none    -&amp;gt; Rule A, delta $124.65
line 4  storage            9 days    billed $ 72.00   card $8.00/day -&amp;gt; clean
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two lines flagged, disputed total &lt;strong&gt;$142.65&lt;/strong&gt;. In the live tool's own sample set the numbers&lt;br&gt;
are &lt;code&gt;Billed lines checked: 4 / Lines flagged: 2 / Disputed total: $224.65&lt;/code&gt; — same shape,&lt;br&gt;
different sample rows. When I ran the real page in a browser after shipping it, those were the&lt;br&gt;
exact strings rendered, and a deliberately broken input produced the exact expected delta.&lt;br&gt;
That is the only kind of verification I trust for a calculator: the number has to move when&lt;br&gt;
the input moves.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three things that broke, in order of embarrassment
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Thousands separators.&lt;/strong&gt; Splitting a CSV on &lt;code&gt;,&lt;/code&gt; while the invoice contains &lt;code&gt;$1,000.00&lt;/code&gt; turns&lt;br&gt;
one thousand dollars into one hundred cents. It parsed fine on every test row I wrote until I&lt;br&gt;
fed it a real-shaped big number. Fix: a &lt;code&gt;splitCsv()&lt;/code&gt; that respects quoted fields, and a test&lt;br&gt;
whose only job is a quoted amount with a comma in it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lines starting with &lt;code&gt;#&lt;/code&gt;.&lt;/strong&gt; Treating a leading &lt;code&gt;#&lt;/code&gt; as a comment is reasonable until the order&lt;br&gt;
number is &lt;code&gt;#1042&lt;/code&gt; — then every order line in the export is silently skipped, and the tool&lt;br&gt;
reports a suspiciously clean invoice. Fix: a leading &lt;code&gt;#&lt;/code&gt; is a comment only when followed by&lt;br&gt;
whitespace or end of line.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Silent defaults.&lt;/strong&gt; The first version priced unmatched fees at zero delta instead of saying&lt;br&gt;
"no basis found". Zero looks like a pass. A checker that quietly passes what it cannot read is&lt;br&gt;
worse than no checker, because it produces confidence. Rule D exists to make that state visible.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it runs in the browser
&lt;/h2&gt;

&lt;p&gt;Invoice CSVs are a company's shipping volumes, SKU mix, and per-unit cost structure — that is&lt;br&gt;
close to the most sensitive document a small brand owns, and there is no good reason for it to&lt;br&gt;
leave their laptop for a first pass. So there is no upload and no account for the free tool:&lt;br&gt;
the parse, the match and the diff all happen client-side, and nothing is stored. If you want a&lt;br&gt;
copy of the numbers, the tool writes a plain-text dispute pack you can paste into an email.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I charge for, and what I don't
&lt;/h2&gt;

&lt;p&gt;The checker is free and unlimited. The thing I do not automate is the judgement call: whether&lt;br&gt;
Rule A's surcharge is actually excluded by clause 4.2 of your contract, and how to write the&lt;br&gt;
dispute so the account manager forwards it instead of filing it. That part is a&lt;br&gt;
&lt;strong&gt;$49 per-invoice review&lt;/strong&gt; — a human reads your card, your invoice, and the flagged lines, and&lt;br&gt;
sends back the dispute pack with the contract citations in it. If a line turns out to be&lt;br&gt;
correctly billed, it comes off the list; the pack is only as aggressive as the card supports.&lt;/p&gt;

&lt;p&gt;If you want to try the mechanics first: the checker is at&lt;br&gt;
&lt;a href="https://www.saasclerk.app/threepl-audit?utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=threepl" rel="noopener noreferrer"&gt;www.saasclerk.app/threepl-audit&lt;/a&gt;&lt;br&gt;
— paste the sample data, change one rate, watch the total move. That "watch it move" step is&lt;br&gt;
the whole point: an invoice you can re-run is an invoice you can argue with.&lt;/p&gt;

</description>
      <category>csv</category>
      <category>logistics</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Your bank's CSV export is the messiest API you will ever consume</title>
      <dc:creator>付小花</dc:creator>
      <pubDate>Mon, 02 Nov 2026 05:41:28 +0000</pubDate>
      <link>https://dev.to/fuxiaohua/your-banks-csv-export-is-the-messiest-api-you-will-ever-consume-16i1</link>
      <guid>https://dev.to/fuxiaohua/your-banks-csv-export-is-the-messiest-api-you-will-ever-consume-16i1</guid>
      <description>&lt;p&gt;I spent two weeks writing a bank-statement parser that runs inside the browser tab. No upload, no server, no account. Paste a CSV export from your card provider, get back the recurring charges hiding in it.&lt;/p&gt;

&lt;p&gt;The part I underestimated was not the recurring-charge logic. It was the file format. Every bank invents its own dialect of CSV, and each dialect exists because someone in 2009 thought it was obvious. Here are the traps that broke my first parser, in the order they broke it, with the rule I ended up shipping.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The header is not on line one
&lt;/h2&gt;

&lt;p&gt;Almost every export opens with a preamble: account holder, masked card number, statement period, a blank line, sometimes a marketing sentence. My first version assumed &lt;code&gt;lines[0]&lt;/code&gt; was the header and produced zero rows on half of the samples.&lt;/p&gt;

&lt;p&gt;The fix is to stop assuming and start searching. I scan the first ten lines, split each one, and ask whether it looks like a header: it needs a date-ish column, a description-ish column, and either an amount column or a debit/credit pair.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;DATE_ALIASES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;date&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;transaction date&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;posted date&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;post date&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;trans date&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;DESC_ALIASES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;description&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;merchant&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;payee&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;memo&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;details&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;AMOUNT_ALIASES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;amount&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;transaction amount&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;DEBIT_ALIASES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;debit&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;withdrawal&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;withdrawals&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;charges&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;CREDIT_ALIASES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;credit&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;deposit&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;deposits&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;payments&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One subtlety matters more than the aliases: a transaction line that appears &lt;em&gt;above&lt;/em&gt; the header must be reported instead of being silently skipped with the preamble. If a row above the header parses as a date, I emit an issue pointing at that line. Quietly ignoring money is the worst possible parser behaviour.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The delimiter is not always a comma
&lt;/h2&gt;

&lt;p&gt;European exports use semicolons. Some accounting tools use tabs. And the sample rule I first wrote, "look at the first line and count separators", fails for exactly the files that need it, because the first line is usually the preamble sentence and it contains no delimiters at all.&lt;/p&gt;

&lt;p&gt;So the sniffing window is the first twenty lines instead of just the first one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sample&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;lines&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;candidate&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;;&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;sample&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;candidate&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;bestCount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;best&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;candidate&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;bestCount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tab wins ties by virtue of being tested first. That is a deliberate choice: a tab-delimited file usually has no commas inside fields, while a comma file with a semicolon in a merchant name is common.&lt;/p&gt;

&lt;p&gt;The splitter itself has to respect quoting, including the doubled-quote escape, or a merchant called &lt;code&gt;"SMITH, J LLC"&lt;/code&gt; becomes two columns and the amount lands in the wrong place.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Negative money has at least four spellings
&lt;/h2&gt;

&lt;p&gt;A charge is positive money leaving the account. Depending on the bank, the same refund looks like any of these:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;-12.99&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;12.99-&lt;/code&gt; (trailing minus, common in mainframe-era exports)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;(12.99)&lt;/code&gt; (accounting parentheses)&lt;/li&gt;
&lt;li&gt;a debit column and a credit column, where the sign lives in the column header&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My parser normalises all four into integer cents before anything else touches the value. Integers instead of floats: &lt;code&gt;0.1 + 0.2&lt;/code&gt; is a well-known way to make a totals column disagree with itself by a cent, and a subscription audit that is one cent off still fails the only test a user runs, which is whether the number matches their statement.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. The same character means two different things
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;1,234.56&lt;/code&gt; and &lt;code&gt;1.234,56&lt;/code&gt; are the same amount. &lt;code&gt;12,50&lt;/code&gt; and &lt;code&gt;1,250&lt;/code&gt; are not, and they are both plausible inputs. The rule I ended up with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;if the string contains a comma and no dot, and exactly two digits follow the last comma, treat the comma as a decimal separator&lt;/li&gt;
&lt;li&gt;otherwise strip every comma
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;parts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]}&lt;/span&gt;&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;
    &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/,/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/,/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Currency symbols, non-breaking spaces and stray letters get stripped before that check. If what remains does not match &lt;code&gt;^\d+(\.\d{1,2})?$&lt;/code&gt;, the amount is rejected and the line is reported as an issue. Rejecting is cheap; guessing is not, because a misread amount corrupts every downstream total silently.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Dates are ambiguous, and guessing is worse than refusing
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;03/04/2026&lt;/code&gt; is March 4th or April 3rd depending on where the file was produced. Six months of a subscription billed on the 4th can look like a monthly cadence or like two weeks of chaos.&lt;/p&gt;

&lt;p&gt;The parser accepts ISO dates and short numeric dates, and exposes a single &lt;code&gt;dayFirst&lt;/code&gt; flag. There is no automatic detection, because automatic detection here means inferring a locale from a file that does not declare one. A user who sees garbled dates can flip one switch; a user who does not notice they are garbled now has a wrong answer they trust.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Merchant descriptors are a compressed format
&lt;/h2&gt;

&lt;p&gt;Raw descriptors look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SP *SPOTIFY USA
PAYPAL *STEAM
SQ *BLUE BOTTLE
POS DEBIT 4821 WHOLEFDS MKT
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;They are written for a 22-character field, so payment processors prepend their own prefixes and banks append store numbers. Grouping by the raw string produces one subscription per location.&lt;/p&gt;

&lt;p&gt;Normalisation does three things: strip known prefixes, unify punctuation, then drop trailing pure-digit tokens (store numbers) and truncate.&lt;/p&gt;

&lt;p&gt;The prefix list has one hard constraint that cost me an afternoon:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// the separator is required, otherwise "SP\s*" eats the first two letters of SPOTIFY&lt;/span&gt;
&lt;span class="o"&gt;/^&lt;/span&gt;&lt;span class="nx"&gt;SP&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;i
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A permissive &lt;code&gt;^SP&lt;/code&gt; turns every Spotify charge into &lt;code&gt;OTIFY USA&lt;/code&gt;, and it groups correctly by accident while being wrong about the merchant name. Requiring at least one separator after the prefix fixes it, and the same pattern applies to &lt;code&gt;SQ&lt;/code&gt;, &lt;code&gt;TST&lt;/code&gt; and &lt;code&gt;PAYPAL&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Turning rows into cadence: why the median wins
&lt;/h2&gt;

&lt;p&gt;Once every row belongs to a normalised merchant, recurrence is a question about intervals. I collect the positive charges, compute the day gaps between consecutive ones, and take the median.&lt;/p&gt;

&lt;p&gt;Median because a single missed month should not move the answer. If a charge lands on the 3rd, the 5th, and then the 2nd of the month after a skipped cycle, the mean interval is inflated and a monthly subscription scores as irregular; the median still says thirty.&lt;/p&gt;

&lt;p&gt;The classification is deliberately narrow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;monthly: median gap 25–35 days, at least 3 charges&lt;/li&gt;
&lt;li&gt;annual: median gap 350–380 days, at least 2 charges&lt;/li&gt;
&lt;li&gt;weekly: median gap 6–8 days, at least 4 charges&lt;/li&gt;
&lt;li&gt;anything else: one-off&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The counts are not decorative. Two charges 30 days apart are as likely to be a coincidence as a subscription, so monthly needs a third observation before it earns a row.&lt;/p&gt;

&lt;p&gt;Confidence is a separate field, and it is where the honesty lives. Monthly is high confidence at four or more charges with every interval within five days of the median; annual needs three charges within ten days; weekly needs six within two. Everything else is medium. A high-confidence row is a claim the tool is willing to defend; a medium row is a hint.&lt;/p&gt;

&lt;p&gt;The monthly equivalent is what makes an annual bill comparable to a monthly one: annual divided by twelve, weekly multiplied by 52 and divided by 12. Sorting by that number is the whole point of the audit, because it answers one question in a fixed order: which line costs the most per month.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. What the audit refuses to claim
&lt;/h2&gt;

&lt;p&gt;Two limits are worth stating, because users find them before you document them.&lt;/p&gt;

&lt;p&gt;The first is aggregated billers. &lt;code&gt;APPLE.COM/BILL&lt;/code&gt; and &lt;code&gt;GOOGLE *...&lt;/code&gt; collapse an entire ecosystem into a single descriptor. The parser flags those rows, and the audit shows them as one line, because the statement does not contain the information needed to split them. Pretending otherwise would produce a confident, wrong breakdown.&lt;/p&gt;

&lt;p&gt;The second is the trial that converts. A subscription billed once has one observation. Until the second charge arrives, it is a one-off, and the tool says so. There is no setting that makes it guess.&lt;/p&gt;

&lt;h2&gt;
  
  
  What comes out
&lt;/h2&gt;

&lt;p&gt;The output is a priority list sorted by monthly equivalent, each row carrying the cadence, the last charge date, the next expected date (last charge plus the median interval), the annual equivalent, and the charge count. Two exports come with it: a CSV and a Markdown table of the same list, so the audit can be pasted into whatever the user actually uses to cancel things.&lt;/p&gt;

&lt;p&gt;And a print stylesheet, because the moment this becomes real is the moment someone holds it next to a phone call.&lt;/p&gt;

&lt;p&gt;The parser is about 500 lines and does not need a backend. If you want to try it on your own export, it runs on &lt;a href="https://www.saasclerk.app/statement-audit?utm_source=devto&amp;amp;utm_campaign=statement_parsing" rel="noopener noreferrer"&gt;the statement audit page&lt;/a&gt;. Paste a redacted export; nothing leaves the tab.&lt;/p&gt;

&lt;p&gt;If you have a bank export that this parser mangles, send me the header line and one broken row (with the amounts changed). Format bugs are the ones I can actually fix.&lt;/p&gt;

</description>
      <category>csv</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>node</category>
    </item>
    <item>
      <title>I removed the account wall from checkout. The 48-hour claim link is where the risk lives.</title>
      <dc:creator>付小花</dc:creator>
      <pubDate>Sun, 01 Nov 2026 03:09:37 +0000</pubDate>
      <link>https://dev.to/fuxiaohua/i-removed-the-account-wall-from-checkout-the-48-hour-claim-link-is-where-the-risk-lives-44nm</link>
      <guid>https://dev.to/fuxiaohua/i-removed-the-account-wall-from-checkout-the-48-hour-claim-link-is-where-the-risk-lives-44nm</guid>
      <description>&lt;p&gt;For a year my checkout had a wall in front of it: an account was required before payment. The reasoning was simple — a subscription has to belong to somebody. The cost was less simple. People who had already decided to buy were asked to invent a password first, and some of them left at exactly that moment. The most expensive step of a funnel is the step that asks for something other than money.&lt;/p&gt;

&lt;p&gt;So I removed the wall. Anyone can now complete a purchase with nothing but an email address. This post is about the second half of that change, which is the part that actually matters: after the money arrives, how does the buyer get the workspace?&lt;/p&gt;

&lt;h2&gt;
  
  
  Two halves, and only one of them is easy
&lt;/h2&gt;

&lt;p&gt;Half one is checkout. An unauthenticated request creates a guest organization, starts a pending billing row, and sends the buyer to the payment provider with a success URL that points at a claim page. No password, no session.&lt;/p&gt;

&lt;p&gt;Half two is the handoff. The payment webhook activates the billing row and upgrades the guest organization — but nobody is logged in as that organization. It exists, it is paid, and it is empty. If I stop there, I have taken money and delivered a row in a database that no human can reach. That is worse than the login wall.&lt;/p&gt;

&lt;p&gt;The naive fix is to match accounts by email: when someone signs up with the email used at checkout, attach the workspace automatically. I rejected it. In B2B, the person who pays is often not the person who uses the product — a founder buys, an operations lead lives in it. Email matching also means anyone who can control that address at any later date inherits a paid workspace, with no expiry and no record of the transfer.&lt;/p&gt;

&lt;p&gt;What I needed instead was an explicit artifact: something the buyer receives, that proves "this order belongs to the holder of this mailbox", expires on its own, and works exactly once.&lt;/p&gt;

&lt;h2&gt;
  
  
  A token with three signed facts
&lt;/h2&gt;

&lt;p&gt;The claim link carries a token with a payload of three fields:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;r&lt;/code&gt; — the payment request id, which identifies the order&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;e&lt;/code&gt; — the email address used at checkout, lowercased&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;x&lt;/code&gt; — an expiry timestamp, 48 hours after the link is generated&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The token is &lt;code&gt;base64url(JSON(payload))&lt;/code&gt; followed by an HMAC-SHA256 signature of that string, using a secret the app already has. Verification checks the signature first and only then parses the payload. That ordering is deliberate: until the signature passes, the payload is just bytes from a stranger.&lt;/p&gt;

&lt;p&gt;Three properties fall out of this design:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tampering is useless.&lt;/strong&gt; The email sits inside the signed payload. Changing it to another address invalidates the signature, so "claim someone else's order by editing the link" gets a 403 instead of a support ticket.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Expiry needs no cleanup job.&lt;/strong&gt; The timestamp is compared against the clock at verification time. There is no token table to sweep and no background worker to forget to deploy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The secret is already there.&lt;/strong&gt; I reuse the application's existing auth secret, with an environment variable that can override it for rotation. Inventing a second secret is how you end up rotating one and forgetting the other.&lt;/p&gt;

&lt;h2&gt;
  
  
  Single use without a token table
&lt;/h2&gt;

&lt;p&gt;The interesting question is "has this link been used?" A token table would answer it directly, and would also mean a schema migration on a live database for a feature that might see three uses this month. I did not want that trade.&lt;/p&gt;

&lt;p&gt;So I defined single use by the effect itself rather than by a record: claiming means attaching the signed-in user to the guest organization. If the organization already has a member, the claim is refused with 410. The state that decides reuse is the same state the product already needs — organization membership — so the two can never disagree. A token cannot say "unused" while the workspace already has an owner.&lt;/p&gt;

&lt;p&gt;The claim flow itself is two steps, and the split is deliberate:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Ask for a link.&lt;/strong&gt; The client posts the order reference and an email address. If they match, I sign a token and send it by email. If they do not match — unknown order, wrong address, already claimed — the response is the same generic 200. Anything more specific would let a stranger probe which order ids exist and which mailbox is attached to each.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use the link.&lt;/strong&gt; The page asks a read-only endpoint whether the token is valid, expired, or already used, then a second endpoint performs the claim. The read-only endpoint only ever returns a masked email (&lt;code&gt;p****@example.com&lt;/code&gt;) and a plan name.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The refusal paths are the feature
&lt;/h2&gt;

&lt;p&gt;A claim flow is mostly a list of things it refuses to do. Mine, with the status codes I return and why:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;403 — bad signature.&lt;/strong&gt; The token was edited, truncated, or forged.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;410 — expired.&lt;/strong&gt; Past the 48-hour window. The buyer can request a fresh link with the same email.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;410 — already used.&lt;/strong&gt; The organization has a member.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;401 — no session.&lt;/strong&gt; A valid link, but nobody is signed in yet. The page offers sign-in and comes back to the same token.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;403 — email mismatch.&lt;/strong&gt; Signed in, but with a different address than the one on the order. I do not guess which one is "probably them".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;409 — already in an organization.&lt;/strong&gt; The account already belongs to a workspace. Merging two workspaces is a human decision, and it stays that way.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of these mutate money. The billing row was already active when the webhook arrived; claiming only moves a membership. That separation is what let me ship the whole thing without touching the payment code path.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I deliberately did not build
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;No new table.&lt;/strong&gt; The token is stateless and the single-use check reads existing membership. Zero migrations for this feature.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No passwordless login.&lt;/strong&gt; The claim link proves ownership of an order. It says nothing about who controls the account, and the buyer still signs in with any method the app supports before the two addresses are compared. Mixing the two would mean a leaked link is also a leaked session.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No "claim by email later" fallback.&lt;/strong&gt; If the order has no email on file, the page says so and asks the buyer to reply to the receipt. A human attaching that order is slower, but an automatic rule for unattached orders is a rule for stealing them.&lt;/p&gt;

&lt;h2&gt;
  
  
  The general shape
&lt;/h2&gt;

&lt;p&gt;If you are removing an account wall from a payment flow, the wall does not disappear. It moves behind the transaction, and it becomes an artifact with four properties: bound to the order, bound to the payer, self-expiring, and single-use. The artifact is cheap to build; the discipline is in refusing to add any path that bypasses it.&lt;/p&gt;

&lt;p&gt;The other lesson is about ordering. I shipped the claim flow &lt;em&gt;with&lt;/em&gt; the guest checkout, in the same change. An account wall removed alone is a funnel improvement that silently converts into unpaid-for promises — money in, workspace unreachable. If you cannot describe how the buyer gets access after paying, you have not finished removing the login wall; you have just moved it to your support inbox.&lt;/p&gt;




&lt;p&gt;SaaSClerk audits SaaS subscriptions, seat counts and renewal dates in one ledger, so the money you spend matches the seats people actually use: &lt;a href="https://www.saasclerk.app/unused-seat-calculator?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=guest_claim" rel="noopener noreferrer"&gt;saasclerk.app&lt;/a&gt;&lt;/p&gt;

</description>
      <category>buildinpublic</category>
      <category>product</category>
      <category>saas</category>
      <category>startup</category>
    </item>
    <item>
      <title>A discount is a percentage of a number nobody wrote down</title>
      <dc:creator>付小花</dc:creator>
      <pubDate>Sun, 01 Nov 2026 01:01:09 +0000</pubDate>
      <link>https://dev.to/fuxiaohua/a-discount-is-a-percentage-of-a-number-nobody-wrote-down-2i17</link>
      <guid>https://dev.to/fuxiaohua/a-discount-is-a-percentage-of-a-number-nobody-wrote-down-2i17</guid>
      <description>&lt;p&gt;Every procurement tool sells the same moment: the purchase. An intake form, an approval chain, a benchmark of what comparable companies paid, a negotiator who runs the call. It is a good product, and it is the wrong place to start when the company has eleven people.&lt;/p&gt;

&lt;p&gt;Not because negotiation is worthless. Because a discount is a percentage of a number, and at eleven people the number usually lives in three different places: a card statement, a founder's memory, and a billing inbox nobody opens. The percentage has nothing to multiply.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where small-team spend actually goes
&lt;/h2&gt;

&lt;p&gt;We build a tool that reads billing email and produces a subscription list, so we have a biased view of the problem. Still, the arithmetic is not biased. Of every ten charges on a small company's card in a given quarter, most are not new purchases. They are renewals of decisions made months ago, sometimes by people who no longer work there. A purchase decision has a moment and a person attached. A renewal has a date and often no person at all.&lt;/p&gt;

&lt;p&gt;That asymmetry explains a pattern we keep seeing in the complaints we collect: the person who asks "how do I cancel this" rarely asks about the purchase. They ask about the thing that renewed. Nobody negotiated it, because nobody knew it was coming.&lt;/p&gt;

&lt;h2&gt;
  
  
  What an inventory looks like as data
&lt;/h2&gt;

&lt;p&gt;The useful artifact is not a dashboard. It is a table with one row per vendor and an append-only record of amounts. Two tables, nine columns, no magic:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;create&lt;/span&gt; &lt;span class="k"&gt;table&lt;/span&gt; &lt;span class="n"&gt;subscription&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;id&lt;/span&gt;            &lt;span class="n"&gt;uuid&lt;/span&gt; &lt;span class="k"&gt;primary&lt;/span&gt; &lt;span class="k"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;vendor&lt;/span&gt;        &lt;span class="nb"&gt;text&lt;/span&gt; &lt;span class="k"&gt;not&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;owner&lt;/span&gt;         &lt;span class="nb"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;interval&lt;/span&gt;      &lt;span class="nb"&gt;text&lt;/span&gt; &lt;span class="k"&gt;not&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;          &lt;span class="c1"&gt;-- monthly | yearly | one_time | unknown&lt;/span&gt;
  &lt;span class="n"&gt;next_charge&lt;/span&gt;   &lt;span class="nb"&gt;date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;status&lt;/span&gt;        &lt;span class="nb"&gt;text&lt;/span&gt; &lt;span class="k"&gt;not&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="s1"&gt;'active'&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;create&lt;/span&gt; &lt;span class="k"&gt;table&lt;/span&gt; &lt;span class="n"&gt;charge&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;id&lt;/span&gt;              &lt;span class="n"&gt;uuid&lt;/span&gt; &lt;span class="k"&gt;primary&lt;/span&gt; &lt;span class="k"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;subscription_id&lt;/span&gt; &lt;span class="n"&gt;uuid&lt;/span&gt; &lt;span class="k"&gt;not&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt; &lt;span class="k"&gt;references&lt;/span&gt; &lt;span class="n"&gt;subscription&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;amount&lt;/span&gt;          &lt;span class="nb"&gt;numeric&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;not&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;currency&lt;/span&gt;        &lt;span class="nb"&gt;char&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;not&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;charged_on&lt;/span&gt;      &lt;span class="nb"&gt;date&lt;/span&gt; &lt;span class="k"&gt;not&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;source_message&lt;/span&gt;  &lt;span class="nb"&gt;text&lt;/span&gt; &lt;span class="k"&gt;not&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;         &lt;span class="c1"&gt;-- the receipt this came from&lt;/span&gt;
  &lt;span class="k"&gt;unique&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;subscription_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;charged_on&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The unique key is doing quiet work. Parsing the same receipt twice is free; the second insert is a no-op. &lt;code&gt;next_charge&lt;/code&gt; is derived from the most recent charge plus the interval, never typed by hand, because a hand-typed date is a promise nobody checked.&lt;/p&gt;

&lt;p&gt;The query that earns the table back is short:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;vendor&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;owner&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;next_charge&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;currency&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;subscription&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;
&lt;span class="k"&gt;join&lt;/span&gt; &lt;span class="k"&gt;lateral&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;currency&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;charge&lt;/span&gt;
  &lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;subscription_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;
  &lt;span class="k"&gt;order&lt;/span&gt; &lt;span class="k"&gt;by&lt;/span&gt; &lt;span class="n"&gt;charged_on&lt;/span&gt; &lt;span class="k"&gt;desc&lt;/span&gt; &lt;span class="k"&gt;limit&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt; &lt;span class="k"&gt;on&lt;/span&gt; &lt;span class="k"&gt;true&lt;/span&gt;
&lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'active'&lt;/span&gt;
  &lt;span class="k"&gt;and&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;next_charge&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="k"&gt;current_date&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;interval&lt;/span&gt; &lt;span class="s1"&gt;'14 days'&lt;/span&gt;
&lt;span class="k"&gt;order&lt;/span&gt; &lt;span class="k"&gt;by&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;next_charge&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fourteen days is a product decision, not a law. The point is that the window is a query, so it can be a weekly email instead of a meeting.&lt;/p&gt;

&lt;h2&gt;
  
  
  The leak that negotiation cannot see
&lt;/h2&gt;

&lt;p&gt;A price change is the second signal the two-table shape gives you for free. When the latest amount differs from the previous one for the same vendor, something happened: a tier moved, a seat was added, a promo ended. No procurement process is involved in that event. It is a diff between two rows.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="n"&gt;subscription_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;charged_on&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;charge&lt;/span&gt; &lt;span class="n"&gt;c1&lt;/span&gt;
&lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="k"&gt;exists&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;charge&lt;/span&gt; &lt;span class="n"&gt;c2&lt;/span&gt;
  &lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;c2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;subscription_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;c1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;subscription_id&lt;/span&gt;
    &lt;span class="k"&gt;and&lt;/span&gt; &lt;span class="n"&gt;c2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;charged_on&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;c1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;charged_on&lt;/span&gt;
    &lt;span class="k"&gt;and&lt;/span&gt; &lt;span class="n"&gt;c2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;c1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run that once and you will find at least one vendor where the amount went up and nobody chose it. That is the leak, and it is invisible to any tool that only models purchases.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where a buying platform earns its price
&lt;/h2&gt;

&lt;p&gt;None of this argues against negotiation. It argues for sequence. Once the list exists, three things become possible that were guesses before:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You know which vendors are large enough to be worth a call. Most are not; the tail is small and frequent.&lt;/li&gt;
&lt;li&gt;You know the exact renewal date, so a negotiation has a deadline instead of a vibe.&lt;/li&gt;
&lt;li&gt;You can tell a benchmark apart from your own bill. The benchmark says what a fair price is; your charge row says what you are paying.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Companies that get to a hundred people and start signing multi-year agreements should absolutely bring in a negotiation service. The stage where that pays for itself arrives later than founders expect, and it arrives right after the inventory problem is solved. Until then, the discount is theoretical.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ownership is the part software cannot do
&lt;/h2&gt;

&lt;p&gt;One row, one owner, one date. Our free scan builds the first two tables from twelve months of billing email with a read-only mailbox scope; renewal alerts go out fourteen days before the charge. What it cannot do is decide that the row belongs to a person. Fifteen minutes a week, one dated list, someone who notices. That is the whole management system at this size, and it is the input every bigger system assumes already exists.&lt;/p&gt;

&lt;p&gt;If you want to see what the list says about your own company, &lt;a href="https://www.saasclerk.app/unused-seat-calculator?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=q077b" rel="noopener noreferrer"&gt;the seat ledger calculator runs the arithmetic in your browser&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>saas</category>
      <category>startup</category>
      <category>tools</category>
    </item>
    <item>
      <title>When Will You Charge Me Next? A Billing Page Owes That Answer.</title>
      <dc:creator>付小花</dc:creator>
      <pubDate>Sat, 31 Oct 2026 18:20:34 +0000</pubDate>
      <link>https://dev.to/fuxiaohua/when-will-you-charge-me-next-a-billing-page-owes-that-answer-58ja</link>
      <guid>https://dev.to/fuxiaohua/when-will-you-charge-me-next-a-billing-page-owes-that-answer-58ja</guid>
      <description>&lt;p&gt;Every subscription interface eventually gets the same two questions: when is the next charge, and what happens if I cancel right now. A page that only shows a plan name and a status word answers neither. It also hides the case that matters most: the customer who believes a date that was never real.&lt;/p&gt;

&lt;p&gt;Here is the short version of what went wrong in ours, and the three rules that fixed it. The subscription period has to be stored as data, not inferred at render time. The payment provider sends period start, period end and a cancellation timestamp as &lt;strong&gt;optional&lt;/strong&gt; fields. Store whatever arrived, show nothing when nothing arrived, and keep "the day coverage ends" separate from "the day the card is charged".&lt;/p&gt;

&lt;h2&gt;
  
  
  The fields are optional, and the webhook knows it
&lt;/h2&gt;

&lt;p&gt;Webhook payloads for subscription events carry the period, but not as required fields. A cancellation event might carry the end of the period and no charge date. A plan change might carry a new period and nothing else. Code that assumes all four fields exist will throw on the first partial event; code that fills the gaps with "today" or "same day next month" will silently print a date the provider never promised.&lt;/p&gt;

&lt;p&gt;A guessed renewal date is worse than an empty row. An empty row produces the question "when am I charged?". A made-up date produces quiet confidence, and the person most likely to trust it is the one who wanted to cancel before it renewed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rule one: parse without guessing
&lt;/h2&gt;

&lt;p&gt;Keep the parser pure and let it return &lt;code&gt;null&lt;/code&gt; for anything it cannot read. A date-shaped string is not automatically a date, and a period token with punctuation in it is not a period.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;parseBillingPeriod&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;source&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;BillingPeriodSource&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;source&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;billingPeriod&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;string&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;source&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;billingPeriod&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;billingPeriod&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sr"&gt;/^&lt;/span&gt;&lt;span class="se"&gt;[&lt;/span&gt;&lt;span class="sr"&gt;a-z&lt;/span&gt;&lt;span class="se"&gt;]{3,20}&lt;/span&gt;&lt;span class="sr"&gt;$/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;token&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;currentPeriodStart&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;parseInstant&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;source&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;currentPeriodStart&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="na"&gt;currentPeriodEnd&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;parseInstant&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;source&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;currentPeriodEnd&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="na"&gt;canceledAt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;parseInstant&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;source&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;canceledAt&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The regex is a reject-list, not an allow-list. If the provider adds a new period word tomorrow, the value should still be stored. The function only refuses values that cannot be a period at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rule two: write without erasing
&lt;/h2&gt;

&lt;p&gt;A later webhook often carries fewer fields than an earlier one. If the update writes every column, the period that arrived yesterday is replaced by &lt;code&gt;null&lt;/code&gt;. Build the update object from the fields that actually arrived.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;billingPeriodUpdate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;source&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;BillingPeriodSource&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;parseBillingPeriod&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;source&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;out&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;BillingPeriodUpdate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;billingPeriod&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;billingPeriod&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;billingPeriod&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currentPeriodStart&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currentPeriodStart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currentPeriodStart&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currentPeriodEnd&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currentPeriodEnd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currentPeriodEnd&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;canceledAt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;canceledAt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;canceledAt&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;out&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This function never produces &lt;code&gt;null&lt;/code&gt;. That is the whole point: &lt;code&gt;null&lt;/code&gt; means "nothing to change", and a separate explicit path exists for the rare case where a value really should be cleared.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rule three: canceling is not a charge date
&lt;/h2&gt;

&lt;p&gt;After a cancellation is scheduled, the period end is the last day of coverage, not the next charge. Two different questions, two different fields on the screen. Printing the end-of-term date under "next charge" tells a customer the opposite of what just happened.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;WILL_CHARGE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;active&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;past_due&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;nextChargeAt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;periodEnd&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;periodEnd&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;WILL_CHARGE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;periodEnd&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;activeUntil&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;periodEnd&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;periodEnd&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;canceling&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;periodEnd&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Make it fail in tests, not in the invoice
&lt;/h2&gt;

&lt;p&gt;Because the parsing is a pure function, every failure can be reproduced locally without a payment provider, a webhook tunnel or a test card. Each case gets a counter-case that must produce the other answer, otherwise the test only proves the function returns &lt;em&gt;something&lt;/em&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;an empty payload returns all nulls, not today's date;&lt;/li&gt;
&lt;li&gt;a payload with one valid period token still accepts that token;&lt;/li&gt;
&lt;li&gt;a garbage date produces an empty update object, not a null column;&lt;/li&gt;
&lt;li&gt;a canceling subscription returns an end date and no charge date, and the reverse for an active one.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Four tests, four counter-cases, no mocks. The negative half is what makes the suite worth running.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the page shows when it knows nothing
&lt;/h2&gt;

&lt;p&gt;A workspace that has never paid has no period row at all. That is a normal state, not an error. The billing page renders a sentence saying there is no charge scheduled, and the next-charge field stays empty. The same rule covers a paid workspace whose provider has not yet sent a period: the status is shown, the date is not.&lt;/p&gt;

&lt;p&gt;Cancellation follows the same discipline. The button calls the provider's merchant API and mirrors what the API returns; the local plan is not downgraded early, because a customer who paid through the end of the month keeps the features through the end of the month. If the provider rejects the request, nothing local changes and the customer is told to try again instead of seeing a success that did not happen.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this matters beyond one page
&lt;/h2&gt;

&lt;p&gt;The same three rules apply to any system that receives dates from someone else: parse without guessing, write without erasing, and keep related-but-different dates in different fields. Applied to a spend audit, that is the difference between a renewal calendar and a decoration.&lt;/p&gt;




&lt;p&gt;The full write-up, with the schema comment and the exact gate commands we run before shipping, is on our own site: &lt;a href="https://www.saasclerk.app/blog/billing-page-next-charge-date" rel="noopener noreferrer"&gt;When will you charge me next? A billing page owes that answer.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to price the waste you already have before changing how you track it, the &lt;a href="https://www.saasclerk.app/unused-seat-calculator?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=q077b" rel="noopener noreferrer"&gt;unused-seat calculator&lt;/a&gt; takes seat counts and prices and returns the monthly and yearly figure, no account required.&lt;/p&gt;

</description>
      <category>saas</category>
      <category>webdev</category>
      <category>api</category>
      <category>startup</category>
    </item>
    <item>
      <title>Your seat count is in two systems and nobody reconciles them</title>
      <dc:creator>付小花</dc:creator>
      <pubDate>Sat, 31 Oct 2026 13:11:48 +0000</pubDate>
      <link>https://dev.to/fuxiaohua/your-seat-count-is-in-two-systems-and-nobody-reconciles-them-46en</link>
      <guid>https://dev.to/fuxiaohua/your-seat-count-is-in-two-systems-and-nobody-reconciles-them-46en</guid>
      <description>&lt;p&gt;Every company I have looked at pays for seats that no one opened this month. Not many, usually — two or three out of twenty, sometimes five. The amount per seat is small, so it never becomes a meeting. It becomes a line item that renews eleven times a year.&lt;/p&gt;

&lt;p&gt;The reason is structural: the number of seats you pay for lives in a billing system. The number of people who actually use the tool lives in an admin console, an identity provider, or somebody's memory of who left in March. Nothing in the normal course of business forces those two numbers to meet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the gap comes from
&lt;/h2&gt;

&lt;p&gt;Four things, in order of how often I see them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Onboarding over-provisions.&lt;/strong&gt; A new team of five gets five seats before anyone knows whether all five will use the tool. Two of them end up living in a different product and the seats stay.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Offboarding stops at the account.&lt;/strong&gt; The person leaves, the laptop comes back, the identity provider account is disabled — and the vendor keeps billing the seat, because nothing in the company owns that relationship.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contractor seats get bought on the company card&lt;/strong&gt; and never appear in the headcount the finance team reconciles against.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Annual plans hide the change.&lt;/strong&gt; On monthly billing, the waste shows up as a smaller next invoice. On annual billing it shows up once a year, at renewal, when it is already too late to do anything but renew or fight.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of these are dramatic. Each one is one seat. The problem is that they compound quietly across every tool in the stack.&lt;/p&gt;

&lt;h2&gt;
  
  
  The 30-second version
&lt;/h2&gt;

&lt;p&gt;For each tool, you need four numbers. You almost certainly have all of them already:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;seats you pay for&lt;/li&gt;
&lt;li&gt;price per seat per month&lt;/li&gt;
&lt;li&gt;seats with activity in the last 30 days&lt;/li&gt;
&lt;li&gt;billing cycle (monthly or annual)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Then:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;waste per month = (seats paid − seats used) × price per seat
waste per year  = waste per month × 12
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;That is the whole calculation. It is not a dashboard, it does not need an integration, and it does not need your billing inbox.&lt;/p&gt;

&lt;h2&gt;
  
  
  A worked example
&lt;/h2&gt;

&lt;p&gt;A 22-person team, four tools, all monthly:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;Seats paid&lt;/th&gt;
&lt;th&gt;Seats used&lt;/th&gt;
&lt;th&gt;$/seat/mo&lt;/th&gt;
&lt;th&gt;Waste/mo&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Design suite&lt;/td&gt;
&lt;td&gt;22&lt;/td&gt;
&lt;td&gt;14&lt;/td&gt;
&lt;td&gt;15&lt;/td&gt;
&lt;td&gt;120&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Project tracker&lt;/td&gt;
&lt;td&gt;22&lt;/td&gt;
&lt;td&gt;19&lt;/td&gt;
&lt;td&gt;12&lt;/td&gt;
&lt;td&gt;36&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Analytics&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;45&lt;/td&gt;
&lt;td&gt;135&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Meeting notes&lt;/td&gt;
&lt;td&gt;22&lt;/td&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;88&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;That is $379 per month, $4,548 per year, from four lines nobody had compared. The interesting part is not the total — it is the ratio: none of these tools were at 100% usage, and the largest single leak was the analytics tool where each unused seat cost almost six times as much as an unused seat in meeting notes.&lt;/p&gt;

&lt;p&gt;The ranking that matters is dollars wasted per tool. Counting idle seats instead puts the wrong tool at the top, because the tool with the most idle seats is rarely the one costing the most.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three traps that make the number wrong
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Tiered pricing.&lt;/strong&gt; If removing seats moves you to a lower tier, the saving is bigger than &lt;code&gt;idle × price&lt;/code&gt;. If it moves you to a higher per-seat price, the saving is smaller. Check the pricing page before you promise yourself a refund.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Annual contracts.&lt;/strong&gt; An idle seat on an annual plan does not save money this month. It saves money at renewal, and only if someone remembers. Write the renewal date down next to the number.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bundled seats.&lt;/strong&gt; Some plans include seats in the platform fee. Those idle seats cost nothing, so keep them out of the total or you will inflate the case and lose the argument with finance.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would actually do with the number
&lt;/h2&gt;

&lt;p&gt;Two moves, in this order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Cut the obvious ones now.&lt;/strong&gt; The seats belonging to people who left, and the seats nobody has opened in 30 days. This needs no negotiation, only an admin console and a decision.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Put the rest on a renewal calendar.&lt;/strong&gt; Every tool that is annual, with the waste number and the renewal date side by side. The decision at renewal is different when it is a number instead of a feeling.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The team-level version of this — reading 12 months of billing email and building the full inventory — is what my product does. But the first pass takes thirty seconds and needs nothing from anyone.&lt;/p&gt;

&lt;p&gt;If you want the four-column check without doing the arithmetic, I put it here: &lt;a href="https://www.saasclerk.app/unused-seat-calculator?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=unused_seats_calculator" rel="noopener noreferrer"&gt;unused seat calculator&lt;/a&gt;. It runs in the browser, no signup, no email, and it will email you the per-tool table if you want to forward it to whoever owns the budget.&lt;/p&gt;

&lt;p&gt;One honest note: the calculator is free, it is the only thing on the site that asks for nothing, and I built it because every conversation about SaaS waste starts with the same four numbers.&lt;/p&gt;

</description>
      <category>management</category>
      <category>operations</category>
      <category>saas</category>
    </item>
    <item>
      <title>Your billing inbox is an append-only log. Our database was not.</title>
      <dc:creator>付小花</dc:creator>
      <pubDate>Sat, 31 Oct 2026 09:08:11 +0000</pubDate>
      <link>https://dev.to/fuxiaohua/your-billing-inbox-is-an-append-only-log-our-database-was-not-5hmk</link>
      <guid>https://dev.to/fuxiaohua/your-billing-inbox-is-an-append-only-log-our-database-was-not-5hmk</guid>
      <description>&lt;p&gt;Every spend-tracking tool starts the same way. It reads receipts out of a billing inbox, copies what it parses into rows, and then keeps scanning. The mail server holds the messages forever and never changes them. The rows are ours, and we are free to rewrite them badly.&lt;/p&gt;

&lt;p&gt;We rewrote ours badly twice before the second fix held. Both bugs were invisible in the UI, because in both cases the UI was showing a number that could not be wrong yet.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the first version did
&lt;/h2&gt;

&lt;p&gt;The scanner matched a vendor name and a price out of each email, found the existing subscription record, and updated it. On a match, the price field was simply assigned the parsed number:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;update&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;monthlyCost&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;parsedCost&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There was no history in that line. If a vendor raised its price, the previous figure disappeared. If the parser misread a renewal date, the old one was gone too.&lt;/p&gt;

&lt;p&gt;That looks harmless until someone asks the question they actually have: &lt;strong&gt;what changed at the last renewal?&lt;/strong&gt; The answer requires two points in time per vendor. An overwritten value leaves one. No amount of UI work recovers a comparison from a single number.&lt;/p&gt;

&lt;h2&gt;
  
  
  Then the invoice table turned out to be worse
&lt;/h2&gt;

&lt;p&gt;Invoices were written with a plain insert on every scan, and the table had no unique key of any kind. So scanning the same mailbox twice turned one real charge into two identical rows.&lt;/p&gt;

&lt;p&gt;Worse than duplicates: the comparison view compared a charge against its own copy, saw equal amounts, and printed &lt;em&gt;unchanged&lt;/em&gt;. A confident all-clear on duplicate data is worse than an empty table, because a green number stops the next question.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two fixes, in this order
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Give the invoice an identity
&lt;/h3&gt;

&lt;p&gt;A composite unique key across the mail integration, the vendor, the invoice date, and the amount:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@@unique([emailIntegrationId, providerName, invoiceDate, amount])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is a &lt;strong&gt;weak identity&lt;/strong&gt; and we wrote the weakness down next to it: two charges of the same amount, from the same vendor, on the same day collapse into one row. We accept that because our first source is email receipts, where the alternative is no key at all. The moment a vendor invoice number or a message id is available, it should replace the composite — a vendor-issued number identifies the charge itself, not the shape of the email that announced it.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Write with one upsert
&lt;/h3&gt;

&lt;p&gt;A unique-key conflict with an empty update:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;prisma&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;invoice&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;upsert&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;where&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;compositeKey&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;create&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;row&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;update&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{},&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A check-then-insert pair looks equivalent and is not. The scan is a long job, and two runs can pass the existence check together, then both insert. The database is the only place where that race can be decided.&lt;/p&gt;

&lt;h2&gt;
  
  
  The acceptance test we actually run
&lt;/h2&gt;

&lt;p&gt;Run the scan twice. The invoice row count on the second run does not move. Everything else you measure — subscriptions found, vendors matched, emails parsed — is allowed to change.&lt;/p&gt;

&lt;p&gt;If you only watch "did the scan finish", you will never notice that it finished by adding a second copy of everything.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where this bites outside our product
&lt;/h2&gt;

&lt;p&gt;The same test works by hand, and it is cheap:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Keep every billing email for twelve months.&lt;/li&gt;
&lt;li&gt;Write one line per charge: date, vendor, amount.&lt;/li&gt;
&lt;li&gt;Compare adjacent lines per vendor instead of reading a single total.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A vendor that raised its price shows up as a step. A subscription that was charged twice shows up as a pair on one date — exactly the row a "current subscriptions" screen can never show you, because it stores one number per vendor with no date attached.&lt;/p&gt;

&lt;p&gt;The general rule outlives the product: &lt;strong&gt;an event log you cannot re-read is a state store you cannot audit.&lt;/strong&gt; If the mailbox still has the messages, a rebuild is always possible. If the table is the only copy, a bug in the parser is a permanent loss.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where we are
&lt;/h2&gt;

&lt;p&gt;The unique key and the upsert have shipped, and the renewal delta view (up, down, unchanged, or first seen after connecting) is wired and compares adjacent real invoices. A mailbox still has to be connected before there is anything to compare, which is the honest state of it today.&lt;/p&gt;

&lt;p&gt;The article that describes this on our own site is &lt;a href="https://www.saasclerk.app/blog/billing-inbox-append-only-log" rel="noopener noreferrer"&gt;the billing inbox as an append-only log&lt;/a&gt;. If you want the arithmetic before the architecture, the &lt;a href="https://www.saasclerk.app/unused-seat-calculator?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=q077b" rel="noopener noreferrer"&gt;unused-seat calculator&lt;/a&gt; returns a monthly and yearly waste figure with no account.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Written with an AI clerk in the loop. The bugs, the fixes, and the acceptance test are from our own commit history.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>saas</category>
      <category>database</category>
      <category>backend</category>
    </item>
    <item>
      <title>The invoice is not an audit: three places where seat spend hides</title>
      <dc:creator>付小花</dc:creator>
      <pubDate>Sat, 31 Oct 2026 04:28:25 +0000</pubDate>
      <link>https://dev.to/fuxiaohua/the-invoice-is-not-an-audit-three-places-where-seat-spend-hides-f7l</link>
      <guid>https://dev.to/fuxiaohua/the-invoice-is-not-an-audit-three-places-where-seat-spend-hides-f7l</guid>
      <description>&lt;p&gt;Most spend tools start and end with the invoice. Pull the charges, group them by vendor, sort by amount, draw a chart. It is useful, and it is also the easy half — because the invoice shows what you were billed, while the question of what you actually got lives in a different system.&lt;/p&gt;

&lt;p&gt;I have been collecting the ways this gap gets described by people who live inside it. Five quotes, four different companies, one recurring shape: &lt;strong&gt;the number on the invoice and the number in the admin panel are two different numbers, and nobody's job is to compare them.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  "It pays for access rather than use"
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;"It pays for access rather than use, so unused accounts still cost money and busy AI workloads are not reflected in the charge."&lt;br&gt;
— exactreads, &lt;a href="https://dev.to/exactreads/how-ai-is-changing-saas-pricing-from-seats-to-outcomes-5723?utm_source=devto&amp;amp;utm_medium=article"&gt;How AI Is Changing SaaS Pricing&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That sentence is about seat-based pricing in general, and it is the whole problem in one line. A seat is purchased once and consumed every month. Between those two moments, three things can go wrong — and none of them are visible on the invoice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it hides, part 1: the person left, the seat did not
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;"What happens when someone leaves the team mid-billing-cycle?"&lt;br&gt;
— order_and_chaos_work, &lt;a href="https://dev.to/salable/why-per-seat-pricing-is-way-harder-than-it-looks-58ee?utm_source=devto&amp;amp;utm_medium=article"&gt;Why Per-Seat Pricing Is Way Harder Than It Looks&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Deprovisioning and billing run on different clocks. Access is usually revoked the day someone leaves, because it is a security action with an owner. The seat is freed whenever someone remembers, because it is a finance action with no owner. In between, you pay for a mailbox that bounces.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it hides, part 2: buying a pool is not licensing people
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;"Suppose an enterprise purchases 400 Copilot seats for a workforce that includes 600 employees. The purchase creates a centrally managed pool of seats. It does not automatically license 400 unspecified people, nor does every developer receive a fraction of a license."&lt;br&gt;
— softchris, &lt;a href="https://dev.to/azure/understanding-github-billing-and-management-from-licenses-to-fair-ai-credit-controls-1hli?utm_source=devto&amp;amp;utm_medium=article"&gt;Understanding GitHub Billing and management&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is the version that survives every spreadsheet: the purchase is correct, the headcount is correct, and the overlap between them is unmeasured. A pool of seats gets allocated once, informally, and then never re-examined — while the team underneath it changes shape every quarter.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it hides, part 3: renewal compares the wrong line
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;"At renewal, compare the whole contract value from year to year, rather than only the familiar seat line, and keep your own measures of volume, quality and cost."&lt;br&gt;
— exactreads, same article&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Renewal conversations default to the line item everyone recognizes. That is exactly the line where the number looks stable. The change is in the add-ons, the overage buckets, the second SKU for the same vendor, the tier you were upgraded into during a support call two quarters ago.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the receipt cannot save you
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;"That's also the limit: a receipt is not an audit, and calls that don't go through it don't exist to it."&lt;br&gt;
— rinava, &lt;a href="https://dev.to/rinava/nobody-audits-their-openai-invoice-2n5i?utm_source=devto&amp;amp;utm_medium=article"&gt;Nobody audits their OpenAI invoice&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Substitute any vendor for OpenAI and the sentence still holds. A receipt proves money moved. An audit proves the money bought something. Only the second question ever produces a refund, a downgrade, or a renewal conversation worth having.&lt;/p&gt;

&lt;p&gt;The cloud world learned this years ago, and named the leftovers:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"silent budget killers known as Zombie Resources bleed organizations 24/7"&lt;br&gt;
— asifmuzammil, &lt;a href="https://dev.to/asifmuzammil/your-cloud-bill-is-full-of-zombies-heres-how-i-hunt-them-down-ihn?utm_source=devto&amp;amp;utm_medium=article"&gt;Your Cloud Bill Is Full of Zombies&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;SaaS has the same zombies. They just don't show up on a resource graph, because a seat is not a resource — it is a line in a contract.&lt;/p&gt;

&lt;h2&gt;
  
  
  A ten-minute version you can run today
&lt;/h2&gt;

&lt;p&gt;You do not need a tool for the first pass. You need three lists, side by side, for one vendor:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Billed seats&lt;/strong&gt; — the quantity on the latest invoice, per product.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Entitled seats&lt;/strong&gt; — who currently holds a license in the admin panel.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Active seats&lt;/strong&gt; — who actually signed in during the last 30 days (every admin panel exports this; it is usually a CSV next to the user list).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Then look at the three differences rather than the three totals. Billed minus entitled is the seat you never allocated. Entitled minus active is the seat nobody uses. Whichever of those two numbers is larger tells you which conversation to have first — with finance, or with the team lead.&lt;/p&gt;

&lt;p&gt;Repeat it quarterly, on the vendors where a single seat costs more than a coffee. Annual plans, where the seat count is fixed until renewal, are the ones worth doing first: that is where the gap compounds silently.&lt;/p&gt;

&lt;p&gt;If you want the arithmetic done for you, I built a free calculator that takes per-tool seat counts and prices and prints what is paid for and not used. No account, no email, no card: &lt;a href="https://www.saasclerk.app/unused-seat-calculator?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=q034b" rel="noopener noreferrer"&gt;unused seat calculator&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;One caveat worth stating plainly: none of this works if the admin panel export is stale. Check the export date before you trust the difference — an out-of-date active list will manufacture waste that isn't there.&lt;/p&gt;

</description>
      <category>management</category>
      <category>productivity</category>
      <category>saas</category>
    </item>
    <item>
      <title>The unsubscribe worked. The charge happened anyway.</title>
      <dc:creator>付小花</dc:creator>
      <pubDate>Sat, 31 Oct 2026 00:51:47 +0000</pubDate>
      <link>https://dev.to/fuxiaohua/the-unsubscribe-worked-the-charge-happened-anyway-2kpe</link>
      <guid>https://dev.to/fuxiaohua/the-unsubscribe-worked-the-charge-happened-anyway-2kpe</guid>
      <description>&lt;p&gt;Every few weeks someone launches another app that "finds your subscriptions". Pricing pages, Slack pings, a pretty list of logos with dollar amounts. It is a crowded category, and for a while I assumed the hard part was discovery — pulling billing emails out of an inbox and turning them into rows.&lt;/p&gt;

&lt;p&gt;Then I spent a day reading the subscription-waste threads on Hacker News, and none of the expensive stories were about discovery. They were about what happens after you already know the subscription exists.&lt;/p&gt;

&lt;p&gt;Five comments, five different years, one recurring shape.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. "They ignored my request, were no answers at all"
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;"I stopped using NextDNS when I forgot to cancel subscription and contacted then immediately to issue a refund. They ignored my request, were no answers at all. I am not alone, this is a typical behavior."&lt;br&gt;
— d7w, &lt;a href="https://news.ycombinator.com/item?id=48568078&amp;amp;utm_source=devto&amp;amp;utm_medium=article" rel="noopener noreferrer"&gt;HN 48568078&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The person knew about the subscription. They cancelled. They wrote the refund email the same day. What failed was the last mile: a human on the other side, and any way to prove the request existed.&lt;/p&gt;

&lt;p&gt;Notice how much of that story a spending dashboard cannot fix. A dashboard tells you the charge happened. It tells you nothing about whether anyone read your email.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. "Sign up for a monthly charge when I only need one article"
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;"I am so sick of having to sign up for a monthly charge when I only need one article...and then forgetting to cancel and getting another ding in the next billing cycle."&lt;br&gt;
— Irongirl1, &lt;a href="https://news.ycombinator.com/item?id=44068570&amp;amp;utm_source=devto&amp;amp;utm_medium=article" rel="noopener noreferrer"&gt;HN 44068570&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This one is a pricing-model problem. The purchase was a one-time need; the vendor only sells a recurring commitment. The commenter's proposed fix — credits that do not expire — would require a different business model, and an audit tool cannot bolt that on afterwards.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. When the refund conversation goes silent, the dispute escalates
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;"The owner of ScrapingBee tweeted about a company who forgot to cancel their subscription, they agreed to a partial refund, but then they went silent, and launched a chargeback for $3250."&lt;br&gt;
— KomoD, &lt;a href="https://news.ycombinator.com/item?id=35183931&amp;amp;utm_source=devto&amp;amp;utm_medium=article" rel="noopener noreferrer"&gt;HN 35183931&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I am quoting a comment that quotes a tweet, so treat the details as second-hand. The shape is what matters: a forgotten renewal, a partial refund that was agreed and then not delivered, and a chargeback. A disputed charge is worse than a refund. It costs the vendor fees, the payment-processor relationship, and sometimes the account.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Seats are a contract, and contracts survive layoffs
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;"Unused seats? Still gotta pay for 'em. (It's called \"SaaS waste\" for a reason.) You committed to paying for 50 seats for a year."&lt;br&gt;
— schnebbau, &lt;a href="https://news.ycombinator.com/item?id=29271087&amp;amp;utm_source=devto&amp;amp;utm_medium=article" rel="noopener noreferrer"&gt;HN 29271087&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This commenter is paraphrasing a vendor's reply, so it reads as the vendor's logic. That makes it more useful rather than less: it is the exact sentence that ends the conversation — the intent to cancel meets the fact of a yearly commitment. No tool wins that argument after the fact. The only moment where the argument is winnable is before the renewal, when someone can see the seat count and the contract end date side by side.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Headcount pricing is a growth tax
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;"Pricing tied to headcount means every hiring decision carries an immediate, non-value-adding software overhead."&lt;br&gt;
— ThePoetDL, &lt;a href="https://news.ycombinator.com/item?id=45472221&amp;amp;utm_source=devto&amp;amp;utm_medium=article" rel="noopener noreferrer"&gt;HN 45472221&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Full disclosure: this commenter was promoting their own flat-rate product, so read it as a vendor's argument. The observation still holds — per-seat pricing means the bill grows with the team whether or not the team uses the tool, which is exactly why unused seats accumulate quietly after reorgs.&lt;/p&gt;

&lt;h2&gt;
  
  
  The counter-argument I could not dismiss
&lt;/h2&gt;

&lt;p&gt;The strongest objection in these threads is that the real move happens at the bank:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"The real [...] here is not go to each individual website to one click cancel, but just cancel the direct debit / subscription from in your banking or credit card app."&lt;br&gt;
— lifeisstillgood, &lt;a href="https://news.ycombinator.com/item?id=48865416&amp;amp;utm_source=devto&amp;amp;utm_medium=article" rel="noopener noreferrer"&gt;HN 48865416&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That is correct, and it is also why a bank-level cancel feature is not something I would build into a small audit tool. It needs banking or payment-processor integration, it needs to hold a license to act on your behalf, and it moves the failure mode from "you forgot" to "I cancelled the wrong mandate". The honest scope is smaller: make the renewal visible early enough that you can act yourself.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this changed about the tool I work on
&lt;/h2&gt;

&lt;p&gt;I work on SaaSClerk, which reads a finance mailbox through read-only OAuth, extracts vendor names, amounts and renewal dates from the past 12 months of billing email, and puts them on one dashboard sorted by next renewal. Paid plans email you two weeks before a renewal that is still marked active.&lt;/p&gt;

&lt;p&gt;Three design decisions came out of reading these threads:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Renewal date first.&lt;/strong&gt; A vendor list answers "what do I pay for". A renewal date answers "what happens next". Every row shows the next date and the amount.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Seat count and unit price on the same row.&lt;/strong&gt; The waste in thread 4 was structural, and it was visible in the invoice long before anyone noticed it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No promises about refunds.&lt;/strong&gt; I do not mediate refunds and I do not claim to cancel anything for you. Making a charge visible is a smaller promise, and it is one a tool can actually keep.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What I deliberately did not build
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A bank feed.&lt;/strong&gt; See above: correct idea, wrong liability for a two-person shop.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automatic cancellation.&lt;/strong&gt; If I cancel wrongly, I create the exact dispute in thread 3.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;An "AI will find you savings" number.&lt;/strong&gt; Every audit tool can produce a big number by assuming you would have cancelled everything it flags. I would rather show the charge and let you decide.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you have a subscription story that fits one of these shapes — especially the silence-after-refund one — I would like to hear it in the comments. That story is the one I have the least product answer for.&lt;/p&gt;

&lt;p&gt;If you want to check your own numbers first, there are two free calculators that need no signup: one for &lt;a href="https://www.saasclerk.app/unused-seat-calculator?utm_source=devto&amp;amp;utm_medium=article" rel="noopener noreferrer"&gt;unused seats&lt;/a&gt; and one for &lt;a href="https://www.saasclerk.app/shadow-it-risk-calculator?utm_source=devto&amp;amp;utm_medium=article" rel="noopener noreferrer"&gt;shadow IT exposure&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>saas</category>
      <category>software</category>
    </item>
    <item>
      <title>40 questions, 4 models, 151 answers: what LLMs actually name for SaaS spend</title>
      <dc:creator>付小花</dc:creator>
      <pubDate>Fri, 30 Oct 2026 19:15:52 +0000</pubDate>
      <link>https://dev.to/fuxiaohua/40-questions-4-models-151-answers-what-llms-actually-name-for-saas-spend-m8b</link>
      <guid>https://dev.to/fuxiaohua/40-questions-4-models-151-answers-what-llms-actually-name-for-saas-spend-m8b</guid>
      <description>&lt;p&gt;I keep the books for a small SaaS company, and I also sell a tool that finds unused seats. So the question I care about is boring: when someone asks a model "what should we use to find wasted SaaS spend", which names actually come back?&lt;/p&gt;

&lt;p&gt;Not whether the answer is good. Which names.&lt;/p&gt;

&lt;h2&gt;
  
  
  Method
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;40 buying questions, written the way a finance or ops lead would type them.&lt;/li&gt;
&lt;li&gt;Four models through one API: glm-4.5, glm-4.7, glm-5.1, glm-5.3.&lt;/li&gt;
&lt;li&gt;Every answer stored verbatim, then counted: which product names appear, in how many answers, and per model.&lt;/li&gt;
&lt;li&gt;160 attempts (40 x 4). 151 produced usable text. The other 9 stay in the denominator and nowhere else: 7 stopped at the token ceiling while the model was still reasoning, 2 were refused by a rate limit. Neither was retried into the count.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Average answer length: 4,664 characters. Nothing was trimmed before counting.&lt;/p&gt;

&lt;h2&gt;
  
  
  What came back
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Answers naming it (of 151)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Slack&lt;/td&gt;
&lt;td&gt;general tool&lt;/td&gt;
&lt;td&gt;74&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Okta&lt;/td&gt;
&lt;td&gt;general tool&lt;/td&gt;
&lt;td&gt;65&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Vendr&lt;/td&gt;
&lt;td&gt;SaaS spend vendor&lt;/td&gt;
&lt;td&gt;64&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Zylo&lt;/td&gt;
&lt;td&gt;SaaS spend vendor&lt;/td&gt;
&lt;td&gt;63&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ramp&lt;/td&gt;
&lt;td&gt;finance tool&lt;/td&gt;
&lt;td&gt;63&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Microsoft&lt;/td&gt;
&lt;td&gt;general tool&lt;/td&gt;
&lt;td&gt;60&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Torii&lt;/td&gt;
&lt;td&gt;SaaS spend vendor&lt;/td&gt;
&lt;td&gt;57&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cledara&lt;/td&gt;
&lt;td&gt;SaaS spend vendor&lt;/td&gt;
&lt;td&gt;55&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Productiv&lt;/td&gt;
&lt;td&gt;SaaS spend vendor&lt;/td&gt;
&lt;td&gt;52&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Brex&lt;/td&gt;
&lt;td&gt;finance tool&lt;/td&gt;
&lt;td&gt;52&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Two things I did not expect
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. General tools outrank category products.&lt;/strong&gt; Slack, Okta and Microsoft are not spend-management products, yet they outrank every one of them. When the question is about spend, the model reaches for line items people already pay for before it reaches for a category product. That is a naming habit, not a comparison.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The category vendors cluster tightly.&lt;/strong&gt; Vendr 64, Zylo 63, Ramp 63, Torii 57, Cledara 55, Productiv 52, Brex 52. Within four points of each other. That pattern usually means there is no default in the niche yet: the model has seen these names together often enough to list them, but nothing tells it that one of them is the answer.&lt;/p&gt;

&lt;p&gt;And one number that is not flattering: the tool I sell was named in 0 of 151 answers. Not ranked low. Absent. Which is the honest output of this experiment for me: a model can only name what has already been written about, and being useful is not the same as being citable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;One provider, one family of models, one run. Another provider has different retrieval and different defaults.&lt;/li&gt;
&lt;li&gt;40 questions is a sample, not a census. A different phrasing moves the counts.&lt;/li&gt;
&lt;li&gt;Name matching counts a mention, not an endorsement. "Slack" can appear as an example of a bill you already have.&lt;/li&gt;
&lt;li&gt;I wrote the questions and the tool that counts them, so read the framing with that in mind.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where the numbers live
&lt;/h2&gt;

&lt;p&gt;I published the question set, the per-model counts and the misses on the site, no email gate: &lt;a href="https://www.saasclerk.app/research/ai-citation-2026-11?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=ai_citation" rel="noopener noreferrer"&gt;https://www.saasclerk.app/research/ai-citation-2026-11?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=ai_citation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you run the same 40 questions against other providers, I would like the counts. That is the version of this post worth reading.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>saas</category>
      <category>data</category>
    </item>
    <item>
      <title>I scanned 38 products that launched on Hacker News this month. A language model could name 3 of them.</title>
      <dc:creator>付小花</dc:creator>
      <pubDate>Fri, 30 Oct 2026 15:19:54 +0000</pubDate>
      <link>https://dev.to/fuxiaohua/i-scanned-38-products-that-launched-on-hacker-news-this-month-a-language-model-could-name-3-of-2abd</link>
      <guid>https://dev.to/fuxiaohua/i-scanned-38-products-that-launched-on-hacker-news-this-month-a-language-model-could-name-3-of-2abd</guid>
      <description>&lt;p&gt;Every month a few hundred products get posted to Show HN. Most of them are technically alive and commercially invisible. I wanted a number for "invisible", so I ran a scanner over 40 of them.&lt;/p&gt;

&lt;p&gt;A language model could name 3.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I actually measured
&lt;/h2&gt;

&lt;p&gt;I took every Show HN story from the last 30 days through the HN Algolia API — 400 stories, 227 unique non-platform domains after dropping GitHub, YouTube, Notion and similar links. Then I scanned the top 40 by HN score.&lt;/p&gt;

&lt;p&gt;Each scan fetches the public surface of the site (robots.txt, sitemap.xml, llms.txt, the home page) and checks eight things, then asks one language model one question: "Do you know this product, and what is it?"&lt;/p&gt;

&lt;p&gt;The model was deepseek-v4-flash, queried through a single provider on a single day. Other assistants may answer differently, so read everything below as a one-model reading.&lt;/p&gt;

&lt;p&gt;38 of the 40 could be fetched and scored. Two returned nothing I could read.&lt;/p&gt;

&lt;h2&gt;
  
  
  Results
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Check&lt;/th&gt;
&lt;th&gt;Failed&lt;/th&gt;
&lt;th&gt;Share of 38&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Model could not name the product&lt;/td&gt;
&lt;td&gt;35&lt;/td&gt;
&lt;td&gt;92%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Title / description missing or broken&lt;/td&gt;
&lt;td&gt;23&lt;/td&gt;
&lt;td&gt;61%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No JSON-LD structured data&lt;/td&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;td&gt;53%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No /llms.txt&lt;/td&gt;
&lt;td&gt;18&lt;/td&gt;
&lt;td&gt;47%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sitemap missing or unreachable&lt;/td&gt;
&lt;td&gt;12&lt;/td&gt;
&lt;td&gt;32%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No single h1&lt;/td&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;29%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Site blocked or unreadable to plain HTTP&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;8%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;robots.txt blocks an AI crawler&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;3%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Zero products passed all eight checks. The average product passed 5 of 8.&lt;/p&gt;

&lt;p&gt;The three the model could name were pypi.org (an infrastructure project most developers have typed into a terminal), sparkjs.dev and greenvitriol.com. Two of those three are things a model has seen a thousand times in code and docs.&lt;/p&gt;

&lt;h2&gt;
  
  
  The part that surprised me, and then didn't
&lt;/h2&gt;

&lt;p&gt;My assumption going in was that the products with more HN points would score better — that the ones people actually looked at would be the ones described well enough for a machine to quote.&lt;/p&gt;

&lt;p&gt;The data says the opposite, weakly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pearson r between HN points and pass rate: &lt;strong&gt;-0.21&lt;/strong&gt; (n=38).&lt;/li&gt;
&lt;li&gt;Average pass rate of the top 10 by points: 56.5%. Everyone else: 61.7%.&lt;/li&gt;
&lt;li&gt;The three highest-scoring posts this month (81, 42, 38 points) scored 1/5, 3/8 and 3/8.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I want to be careful here. n=38 from a single source is not enough to claim anything causal, and r=-0.21 is weak. What I can say is narrower and still useful: in this sample, human attention and machine readability point in different directions. Getting upvotes does not mean an assistant can describe you when someone asks for a tool like yours.&lt;/p&gt;

&lt;p&gt;That is not surprising once you look at what the two channels reward. HN rewards a good story and a live demo. An assistant quoting you needs a sentence on your site that states what the thing is, in a form that survives being lifted out of context. Those are different artifacts, and most companies only make the first one.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the 7-out-of-8 products had in common
&lt;/h2&gt;

&lt;p&gt;The six products that scored 7 of 8 had all of: a title under 60 characters with the category noun in it, a description that names who it is for, at least one JSON-LD block, a sitemap declared in robots.txt, and exactly one h1. That is a checklist rather than a strategy, yet it is the difference between "a model can describe you" and "a model does not know you exist."&lt;/p&gt;

&lt;p&gt;The single most common failure among otherwise healthy sites was no llms.txt (18 of 38) and no structured data (20 of 38). Neither is exotic. Both are an afternoon.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this does not prove
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;One model, one prompt, one day. A different assistant may answer differently. I did not test ChatGPT, Claude, Perplexity or Gemini, partly because their web sessions block automated use and I was not going to buy four API keys to write a blog post.&lt;/li&gt;
&lt;li&gt;Single GET, no JavaScript execution. Sites that render everything client-side look empty to me and get marked as unreachable. Three of the 40 fall in that bucket, and that is a limitation of my crawler as much as a property of theirs.&lt;/li&gt;
&lt;li&gt;Show HN is a biased sample: technical, self-serve, mostly small teams.&lt;/li&gt;
&lt;li&gt;Knowing the name is the floor; a recommendation is the ceiling. This scan measures the floor.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why I did this at all
&lt;/h2&gt;

&lt;p&gt;I run a one-person company. My site has the same problem as most of the 38 — I scanned it and scored 7/8, with the model unable to name it. That is the honest version: I am selling a check I also fail.&lt;/p&gt;

&lt;p&gt;The scanner is free, no signup, no card: &lt;a href="https://www.saasclerk.app/aeo-scanner?utm_source=devto&amp;amp;utm_medium=article" rel="noopener noreferrer"&gt;https://www.saasclerk.app/aeo-scanner?utm_source=devto&amp;amp;utm_medium=article&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want the raw data to check my work, the per-domain rows (every check, every piece of evidence, every model reply) are what the report is built from, and I am happy to hand over the JSON to anyone who asks in the comments.&lt;/p&gt;

&lt;p&gt;One question I would actually like answered: if an assistant cannot name your product, does that show up anywhere in your analytics, or is it invisible by construction? I suspect the second, and that is why nobody fixes it.&lt;/p&gt;

</description>
      <category>buildinpublic</category>
      <category>saas</category>
      <category>ai</category>
      <category>data</category>
    </item>
    <item>
      <title>I built a tool to find SaaS waste in a billing inbox. Seven accounts, none of them paying.</title>
      <dc:creator>付小花</dc:creator>
      <pubDate>Fri, 30 Oct 2026 14:27:39 +0000</pubDate>
      <link>https://dev.to/fuxiaohua/i-built-a-tool-to-find-saas-waste-in-a-billing-inbox-seven-accounts-none-of-them-paying-104k</link>
      <guid>https://dev.to/fuxiaohua/i-built-a-tool-to-find-saas-waste-in-a-billing-inbox-seven-accounts-none-of-them-paying-104k</guid>
      <description>&lt;p&gt;Last quarter I found a $99/mo tool my company had been paying for fourteen months. Nobody had opened it since the trial ended. The invoices were sitting in the finance inbox the entire time.&lt;/p&gt;

&lt;p&gt;That is the whole idea behind SaaSClerk: a billing inbox already knows every subscription a company pays for. Every receipt, every renewal notice, every quiet price increase is in there. Nobody reads it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it actually does
&lt;/h2&gt;

&lt;p&gt;You connect a finance or billing mailbox over read-only OAuth. A scan covers the last 12 months, capped at 300 messages per scan. It pulls vendor, amount, billing period and renewal date out of the receipts and builds one inventory sorted by next renewal date. On paid plans you get an email 14 days before a subscription marked active renews, so the charge shows up before it lands rather than after.&lt;/p&gt;

&lt;p&gt;Privacy model, stated plainly: the OAuth scope is read-only, mail credentials are sealed with AES-256-GCM before they are stored, and email bodies are not stored. Only the extracted fields survive a scan. Revoke access at the provider and the scan stops working.&lt;/p&gt;

&lt;p&gt;Stack is Next.js App Router, Prisma, Postgres, deployed on Vercel. Starter is $49/mo.&lt;/p&gt;

&lt;h2&gt;
  
  
  The honest number
&lt;/h2&gt;

&lt;p&gt;Seven accounts exist. Three of them are mine, created while testing the signup flow. Zero paying customers, $0 MRR. The product works end to end and checkout is live; nobody outside my own testing has converted, which is the thing I am trying to understand.&lt;/p&gt;

&lt;p&gt;Not built, deliberately: no bank or card feed, no SSO, no multi-entity rollup, and no "AI insights" tab.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three questions I would like answered
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Is handing a mailbox to a small vendor a non-starter for you? If yes, what would you accept instead: a forwarding alias, a CSV, a card feed?&lt;/li&gt;
&lt;li&gt;Is a 300-message cap over a 12-month window too coarse to trust the inventory?&lt;/li&gt;
&lt;li&gt;For a $49/mo tool aimed at a 20-person company, which objection kills it first?&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  One engineering note
&lt;/h2&gt;

&lt;p&gt;The scan does not do anything clever with a model. Receipts are parsed with per-vendor matchers over structured fields (sender domain, subject pattern, and the amount/date/currency triples that survive HTML templating), and anything unmatched falls back to a generic extractor that has to produce a vendor, an amount and a period or it is dropped. The inventory is keyed on a normalized vendor plus a plan fingerprint, so a price change on the same plan updates the row instead of creating a new subscription; a different amount with a different period becomes a separate row and gets flagged for review.&lt;/p&gt;

&lt;p&gt;The 300-message cap is the part I am least happy with. It is a cost guard rather than a correctness choice: a busy 20-person company can have 600 or more billing messages in a year, so a scan can miss the oldest months. The fix is pagination with an incremental cursor, but incremental scans need a stable message id per provider, and Gmail and Outlook disagree on what that is.&lt;/p&gt;

&lt;p&gt;The tool is at &lt;a href="https://www.saasclerk.app/?utm_source=devto&amp;amp;utm_medium=article" rel="noopener noreferrer"&gt;https://www.saasclerk.app/?utm_source=devto&amp;amp;utm_medium=article&lt;/a&gt; if you want to look at it. Feedback of the "this would never pass my security review because X" kind is the most useful thing you can give me right now.&lt;/p&gt;

</description>
      <category>buildinpublic</category>
      <category>saas</category>
      <category>tools</category>
      <category>startup</category>
    </item>
  </channel>
</rss>
