Integrations

AI margin per customer for apps that bill with Stripe

In short: FiscaLLM reads your Stripe payments and puts them next to what each customer costs you in OpenAI, Anthropic and Gemini tokens. You see which customers are profitable, which plans and trials lose money, and get an alert when a paying customer starts costing more than they pay. Free and open source (MIT).

What it counts

Stripe eventWhat happens in FiscaLLM
invoice.paidA payment: first payment, renewal, or the conversion after a free trial
customer.subscription.createdA free trial starts: AI cost begins, revenue is $0
customer.subscription.updatedAuto-renew switched off counts as a cancellation
customer.subscription.deletedThe subscription ended
charge.refundedOnly the new part of each refund is subtracted, so partial refunds are never counted twice
charge.dispute.closedA lost dispute (chargeback) is subtracted like a refund; a won one changes nothing

What you keep is the payment minus tax minus Stripe's fee. Save a read-only restricted key and the fee is Stripe's exact fee from the balance transaction, and payments in any currency count at the USD amount Stripe settled. Without a key the fee is estimated (2.9% + $0.30) and only USD counts. Plan changes mid-cycle use the subscription line, not proration lines, and tax is read on every Stripe API version.

Set up in three steps

  1. Tag users. Put your user ID on the subscription: subscription_data: { metadata: { user_id } } at checkout. Report AI usage under the same ID with one line per call, for example meter.trackOpenAI(res, { userId }).
  2. Connect the webhook. Add the webhook URL from your app's Setup page in Stripe and paste its signing secret. Every request is verified, and retries are counted once.
  3. Optional: add a read-only key. Import the last 12 months of history, and get exact fees, other currencies and lost disputes. The key can only read.

Tested end to end against Stripe test clocks: a trial that converts and renews, a partial refund, two lost disputes and a cancellation, checked to the cent. Step-by-step details are in the Stripe docs, and the reasoning behind each number in how to track AI cost per customer against Stripe revenue.

How it compares

ToolPriceOpen sourceStripe
FiscaLLMFreeYes, MIT (server, dashboard and SDKs)Per end user: payments, trials, cancellations, refunds and lost disputes from a webhook, 12 months of history, Stripe's exact fee and any currency with a read-only key
MarginDashHosted plans; see its pricing pageNoStripe connection with a per-customer P&L
MarginMeterSee its siteNot statedRead-only key; company-level margin from balance transactions, net of refunds, disputes and tax
WeckrHobby free (50,000 requests a month), Pro $49 a month (1M requests a month)SDKs are MIT; the service is hostedNot mentioned on its site

Not on Stripe? FiscaLLM also connects RevenueCat in one click, takes a revenue CSV from Paddle or Lemon Squeezy, or any billing system through the revenue API.

Open the demo dashboard (sample data, no sign-up) or start free.

Questions

Does Stripe show AI cost per customer?

No. Stripe knows what each customer paid, not what their usage cost you at OpenAI, Anthropic or Google. FiscaLLM records AI cost per user from your backend and joins it to Stripe payments by user ID.

How does FiscaLLM know which Stripe customer is which user?

Set metadata.user_id on the Stripe subscription or customer to the same user ID your backend sends with AI usage. Without it, the Stripe customer ID is used, so you can also report AI usage under the cus_ ID.

Is the Stripe fee exact?

With a saved read-only restricted key, yes: FiscaLLM reads the fee and the settled USD amount from Stripe's balance transaction. Without a key it estimates the standard 2.9% + $0.30 and counts USD payments only.

Does it handle other currencies?

Yes, with a saved read-only key: a payment in EUR, GBP or any other currency counts at the USD amount Stripe actually settled. Refunds and disputes use the same rate as the payment.

Are chargebacks counted?

Lost disputes are subtracted like refunds, against the same payment, so a refund and a dispute on one charge are never counted twice. Won disputes change nothing. Tracing a dispute back to its customer needs the read-only key.

Can it import past Stripe payments?

Yes. Paste a read-only restricted key to import the last 12 months of paid invoices, refunds, current trials and ended subscriptions. An invoice is counted once whether it arrives by webhook or import, so re-running is safe.

What does it cost?

Nothing. FiscaLLM is free and open source (MIT). Use the hosted service at fiscallm.com or self-host it so your revenue data never leaves your servers.