virling Pricing Self-host Demo Changelog Agencies GitHub Start free trial
integrations / dodo payments for ai apps

See which post, search or AI answer brings your paying users on Dodo Payments.

For founders of AI apps who sell subscriptions, credits or one-off plans through Dodo Payments. Virling ties each payment to the channel that brought the buyer, so you see whether X, Reddit, Google or ChatGPT brings the users who pay, not only the ones who sign up and spend free credits. Virling is open source under AGPL; run it hosted or on your own server.

Start free See the demo

An AI app usually hands out free credits, then sells a plan with included usage, a credit pack or a top-up. A launch post can bring a wave of signups who burn the free credits and leave, while one answer in ChatGPT sends a few users who keep buying. Virling reads your Dodo Payments account with an API key and shows which channel each paid credit came from.

How a payment finds its visit

Dodo checkout runs on its own domain and the payment reaches Virling by API, so on its own it carries no visit. The script adds the visitor ID to payment links on checkout.dodopayments.com, your server sets virling_vid in metadata for checkout sessions, and Virling credits the payment to the latest visit before it that was not Direct, by default. Every checkout type is covered in Link checkout to visits.

Set it up

  1. Add your app as a site and paste the script on the landing page and inside the app. The cookie covers subdomains, so yourapp.com and app.yourapp.com share one visitor.
  2. Paste a Dodo Payments API key under payments. Virling imports 90 days, then reads new payments every minute. If the same Dodo account bills other products, fill in Only these product IDs with this app's plans and credit packs.
  3. Pass the visitor ID on checkouts your server creates. Plain payment links need nothing; a session needs one line of metadata:
const session = await client.checkoutSessions.create({
  product_cart: [{ product_id: "pdt_credits_500", quantity: 1 }],
  return_url: "https://app.yourapp.com/credits",
  metadata: { virling_vid: req.cookies.virling_vid },
});

Credit packs and plans with included usage

On Dodo a credit pack is a one-off product and a plan is a subscription. Virling credits them the same way at first, and differently after that.

  • A first credit pack is a one-off payment, credited from the visitor ID its checkout carries. Put the pack's payment link on a page that runs the script, such as your pricing page or the in-app billing screen.
  • A plan with a monthly credit allowance is a subscription. Its first paid charge is credited the same way, and each later charge of that subscription is a renewal, so the allowance a user pays for months later still counts for the channel that brought them.
  • Switching from packs to a plan, or back, keeps the first channel as long as Dodo keeps the same customer ID, since any payment after a customer's first one is a renewal.
  • One product filter for both. Only these product IDs matches a pack by its cart and a subscription payment by its subscription's product, so list both kinds.

Usage-based billing on Dodo

When a plan bills for metered usage, Virling does not read meters, usage events or credit balances. It records the payment Dodo charges, at its total amount, once it succeeds. A usage charge on a subscription that was already paid before is a renewal and keeps the channel of the user's first payment.

If a usage-only plan starts with a $0 subscription payment, Virling stores that as a trial start, never as revenue. The first usage charge above $0 then counts as the first payment, and when it has no visitor ID of its own, which usage charges rarely do, it is credited to the visits before the plan started. MRR uses the subscription's recurring price, so usage billed on top of it shows in revenue but not in MRR.

Top-ups keep the first channel

A top-up bought from inside the app has no fresh visit behind it, and it does not need one. Any payment after a customer's first, matched by Dodo customer ID, copies the channel, referrer, campaign, landing page, country and device of that first payment. A user who found you through a YouTube demo and keeps topping up for a year counts every one of those payments toward YouTube, and the Retention page adds them up as that channel's net LTV.

If Dodo records a top-up under a different customer ID, it stands alone and is credited from its own visitor ID, like a new customer.

Free credits that never become a payment

Virling counts money, not usage. A user who signs up, spends the free credits and never pays has no Dodo payment, so they add nothing to revenue or customers, while their visits still count. That is what a channel full of free-credit users looks like on the Channels card: many visitors and little revenue per visitor.

A $0 one-off checkout, such as a free starter pack run through Dodo, is not imported at all, and a free plan run as a $0 subscription is kept only as a trial start. To see signups next to payments, send virling("goal", "signup") when an account is created; goals show in each paying user's journey.

Channels that tend to send AI app buyers

Which of these pays best differs per app, so Virling puts each on its own rows instead of guessing.

  • AI assistants. Visits from ChatGPT, Perplexity, Claude, Gemini, Copilot and DeepSeek get the AI channel, and the AI card shows the visitors and revenue per assistant. Whether that traffic pays is the question in is AI search traffic worth anything.
  • Launch sites. Product Hunt, Hacker News, Reddit and Indie Hackers land in Communities, and the Source tab splits them. Tag each launch post with its own utm_campaign so two posts on one site stay apart; Product Hunt launch revenue walks through one launch.
  • YouTube demos. Visits from youtube.com and youtu.be count as Social, with YouTube as the source. Put a tagged link in the video description, since a click from an app can arrive without a referrer and would otherwise be Direct. More in YouTube revenue tracking.

What to know

  • Credit balances are never read, so a user who buys a pack and spends it slowly counts the same as one who spends it all on day one.
  • The first import covers 90 days. A user whose first pack is older than that is matched to their earliest payment in Virling instead, which rarely has a visit, so their top-ups are usually Unattributed.
  • Dodo allows 240 requests a minute, so Virling spreads extra lookups over several rounds, and a big first import can take a few minutes.
  • A pack bought through a payment link opened from an email or another site reaches Dodo without a visitor ID. It still counts as revenue, as Unattributed.

The full walkthrough is in how to track Dodo Payments revenue by traffic source. Every setting is on the Dodo Payments integration page, and Virling for AI apps covers other payment providers.

Open source

Virling is open source under AGPLv3, with the code on GitHub. Use the hosted service, or run the single binary yourself with every feature.

Frequently asked questions

Which channel brings my paying users on Dodo Payments?

Virling reads payments with a Dodo Payments API key and credits each one to the visits before it, using the visitor ID that the payment link or checkout session carries. The Channels card then ranks X, Reddit, Google, ChatGPT and the rest by revenue from paying users, not by signups.

Which channel gets credit for a credit pack top-up on Dodo Payments?

The channel of the user's first payment. A first credit pack is credited from the visitor ID its own checkout carries, and every later pack or top-up under the same Dodo customer ID copies that payment's channel.

Do free credits count as revenue?

No. Only payments Dodo charges count. A user who spends free credits and never pays is a visitor, not a customer, and a $0 subscription payment is kept only as a trial start.

Does Virling read Dodo usage meters?

No. It reads the payments Dodo charges for usage, not the meters or events behind them. A usage charge on a subscription that was paid before is a renewal and keeps the channel of the user's first payment, and MRR counts only the recurring price.

Are visits from ChatGPT and Perplexity tracked?

Yes. Visits referred by chatgpt.com, chat.openai.com, perplexity.ai, claude.ai, gemini.google.com, copilot.microsoft.com and chat.deepseek.com get the AI channel, so revenue from AI answers shows on its own rows.

More in the docs: Dodo Payments, Goals and Renewals.

Start free