> ## Documentation Index
> Fetch the complete documentation index at: https://doc.trackrev.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Pass the visitor id to checkout

> The one line that joins a purchase back to the exact click that produced it — for every payment processor.

Attribution is only exact when the purchase carries the visitor id. The [pixel](/getting-started/install-pixel)
exposes the current visitor id as `window.trk.vid` — pass it into your checkout and TrackRev
joins the resulting charge to the click with certainty. Without it, TrackRev falls back to
matching on email, which is a good safety net but not exact.

<Note>
  Read `window.trk.vid` in the browser at the moment you start checkout. On the server, the same
  value is available as the `vid` cookie.
</Note>

## By processor

<Tabs>
  <Tab title="Stripe">
    **Checkout Session** — set `client_reference_id`:

    ```js theme={null}
    // server-side, when creating the session
    import { cookies } from "next/headers";
    const vid = (await cookies()).get("vid")?.value;

    const session = await stripe.checkout.sessions.create({
      mode: "subscription",
      line_items: [/* ... */],
      success_url: "https://yourapp.com/thanks",
      client_reference_id: vid, // ← the join key
    });
    ```

    **Payment Links / Pricing Table** — append the id or set the attribute:

    ```text theme={null}
    https://buy.stripe.com/abc123?client_reference_id=<vid>
    ```

    ```html theme={null}
    <stripe-pricing-table client-reference-id="<vid>" ...></stripe-pricing-table>
    ```

    You can also set `metadata.vid` on the PaymentIntent as an alternative.
  </Tab>

  <Tab title="Paddle">
    **Paddle.js** — pass `customData`:

    ```js theme={null}
    Paddle.Checkout.open({
      items: [{ priceId: "pri_123", quantity: 1 }],
      customData: { vid: window.trk?.vid },
    });
    ```

    Or append to a hosted link: `?customData[vid]=<vid>`.
  </Tab>

  <Tab title="Polar / Creem / Dodo">
    Pass `metadata`:

    ```js theme={null}
    // Polar / Creem / Dodo checkout
    metadata: { vid: window.trk?.vid }
    ```

    Or append to a hosted checkout link: `?metadata[vid]=<vid>`.
  </Tab>

  <Tab title="Lemon Squeezy">
    Lemon Squeezy attribution is **email-only** — the vid isn't read back from orders. Make sure
    you identify the buyer's email before checkout:

    ```js theme={null}
    window.trk?.identify("customer@example.com");
    ```

    You may still pass custom data for your own records:
    `checkout_data: { custom: { vid: window.trk?.vid } }`.
  </Tab>
</Tabs>

## Verify it's working

After wiring this up, go to **Integrations → Verify your checkout setup → Check attribution
setup**. TrackRev inspects recent checkouts and confirms the `vid` is present and matching. See
[Connect Stripe → Verify your setup](/revenue-attribution/connect-stripe#verify-your-setup) for
what each result means.

<Warning>
  The pixel must be running on the page where checkout **starts** so `window.trk.vid` is defined
  there. If the verifier says *"vid unmatched"*, that's the usual cause.
</Warning>
