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

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

For founders of AI apps and AI wrappers that bill through Stripe with plans, credit packs or top-ups. Virling ties each subscription, credit purchase and top-up to the channel that brought the user, 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. Open source under AGPL, hosted or self-hosted.

Start free trial See the demo

Stripe records the plan or credit pack a user bought, not the post or AI answer that sent them, and a user who returns from a bookmark to buy looks Direct. Virling reads those charges with a read-only key and credits each one through the visitor ID you add to the Checkout Session or PaymentIntent. Stripe in the docs lists where it looks for that ID.

Credit packs and plans are credited differently

  • A plan is a Stripe subscription. Its first charge is credited to the visits before checkout, and each monthly invoice after it, with billing reason subscription_cycle, or subscription_update for an upgrade, keeps the channel of that first payment.
  • A credit pack is a one-off payment, through Checkout in payment mode, a Payment Link or your own PaymentIntent. When the charge carries a Stripe customer ID that already paid before, it counts as a later payment of that customer and keeps their first channel too.
  • A top-up with no customer ID cannot be tied to an earlier payment, so it is credited to its own visit. Pass the visitor ID on every top-up checkout, and pass the same customer on each session if you want a user's packs grouped under one customer.

ChatGPT, Perplexity and other AI answers as a channel

People ask assistants which AI tool to use for a task, and the answer often links to one. Visits referred by chatgpt.com, perplexity.ai, claude.ai, gemini.google.com, copilot.microsoft.com and chat.deepseek.com get the AI channel, checked before search, so Gemini is not mixed into Google. A link tagged utm_source=chatgpt.com with no referrer is AI too. The Funnel tab of the AI card shows, per assistant, how often it crawled you, named you, sent visitors and brought payments, and the revenue from each.

Where free users drop off

Free credits bring many signups and few payers, and launch days make that worse. Virling counts only Stripe charges, so spending free credits never counts as revenue. Send a signup goal when an account is created, and the Funnel tab of the Goals card shows the share of visitors who reach Signup, Checkout started and Paid, with the drop between steps. Filter it by channel: a launch post with many signups and few payments shows its low revenue per visitor next to a smaller channel that converts.

Which channel keeps buying credits

The Retention page groups each customer by the channel, referrer and campaign of their first payment, and adds every later payment, top-ups included, to that channel's net LTV. A credit buyer with no subscription counts as still paying when they bought again within the gap between their last two purchases plus 7 days, or 37 days after a single purchase. Payments without a customer ID count as their visitor, so packs bought from the same browser stay with one customer.

See which channel brings users who pay

For AI apps that sell plans and credit packs through Stripe. Start the hosted version with a 14-day free trial, or run it on your own server for free.

Start free trial See the demo

Set it up

  1. Add your app. Click + Add a site and enter your domain, such as yourapp.com.
  2. Install the script. Put the tag on your landing page and in your app, so yourapp.com and app.yourapp.com share the virling_vid cookie.
  3. Connect Stripe. Paste a restricted key that can only read, with the resources listed in Stripe in the docs. Ninety days of charges come in first.
  4. Pass the visitor ID on every purchase. Set client_reference_id or metadata.virling_vid on each plan and credit pack checkout, or metadata.virling_vid on your own PaymentIntent. Payment Links on buy.stripe.com need no code: the script adds the ID when a visitor clicks one.
  5. Send goals. Call virling("goal", "signup") after signup, so the funnel shows where free users stop.
// A credit pack through Stripe Checkout
await stripe.checkout.sessions.create({
  mode: "payment",
  customer: user.stripeCustomerId,
  line_items: [{ price: "price_credits_1000...", quantity: 1 }],
  client_reference_id: req.cookies.virling_vid,
  // ...
});

ChatGPT revenue tracking covers which visits from AI assistants pay. To store UTM tags or the visitor ID on a Checkout Session or Payment Link, see Stripe Checkout UTM parameters. Every setting is on the Stripe integration page, and Virling for AI apps covers other payment providers.

What to know

  • A credit pack bought from a link in an email or a chat message carries no visitor ID. If its customer paid before, it keeps their first channel; otherwise it counts as Unattributed.
  • Charges from before the 90-day import are not read, so channel numbers fill in as new users buy.
  • Stripe trial starts are read from the time you connect, so trials that started before that are not seen.
  • Purchases made in a mobile app through the App Store or Google Play never reach Stripe. Virling reads those through RevenueCat.

Virling is open source under AGPLv3, and the code is on GitHub.

Frequently asked questions

Which channel brings my paying users on Stripe?

Add the virling_vid visitor ID to every Checkout Session or PaymentIntent, for plans and credit packs alike, and connect Stripe with a key that can only read. The Channels card then shows whether a post, a search or an AI answer brought the users who pay.

Which channel gets credit for a credit top-up on Stripe?

If the top-up's charge has a Stripe customer ID that paid before, it keeps the channel of that customer's first payment, like a renewal. Without a customer ID it is credited to the visits before its own checkout, so pass the visitor ID on every top-up.

Which channel brings users who keep buying credits?

Open the Retention page. It groups each customer by the channel of their first payment and adds every later credit pack to that channel's net LTV, so a channel whose users buy pack after pack shows a higher LTV than one whose users buy once.

How are Stripe subscription renewals attributed?

A charge whose invoice has billing reason subscription_cycle is a renewal. It takes the channel, referrer, campaign, landing page, country and device of the customer's first payment, matched by Stripe customer ID. Upgrades and plan changes (subscription_update) keep that channel too.

Do free credits count as revenue?

No. Only Stripe charges count. A user who spends free credits and never pays is a visitor, and a Stripe checkout with nothing charged is stored as a trial start, not as revenue or a customer.

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.

Full guides: Stripe in the docs, Retention by channel and AI answers.

Start free trial See the demo