---
title: "Polar revenue attribution"
description: "Pass XPmetric visitor IDs into Polar Checkout Session metadata for revenue-by-channel reporting."
source: "https://xpmetric.com/docs/revenue/polar"
---
Connect Polar in **Settings → Integrations**, then pass XPmetric visitor IDs into Checkout Session metadata.

## Prerequisites

1. [Install p.js](/docs/getting-started) on your site.
2. Connect Polar with an Organization Access Token in **Settings → Integrations → Polar**.
3. Create checkout sessions via the **Polar API** — static Checkout Links cannot carry per-visitor metadata.

## Metadata keys

Use the same keys as Stripe:

- `xpm_visitor_id` ← `window.xpmetric.v`
- `xpm_session_id` ← `window.xpmetric.s`

<PolarAttributionSnippets />

XPmetric sync reads these keys from order metadata after connect.

## @polar-sh/nextjs

If you use the Next.js adapter, pass metadata as a URL-encoded JSON query param on your checkout handler route — see the Polar settings panel in XPmetric for the exact snippet.

## Verify

Complete a sandbox or live checkout, then check the site dashboard revenue chart and **Channels → Revenue** view after sync.

## Related

- [Stripe Checkout attribution](/docs/revenue/stripe-checkout)
- [Payments API](/docs/revenue/payments-api)

