Bantico logo
Docs
Integrations

Polar

Connect Polar so Bantico can attribute completed payments back to the tracked link, campaign, source, medium, content, and lead that drove the customer.

The strongest Polar attribution comes from passing Bantico context directly into checkout metadata. That means sending fields like linkId, campaignId, source, medium, content, and leadId.

How to connect Polar

Here's the quickest way to connect Polar to Bantico.

  1. Open Polar access tokens.
  2. Create a new access token for Bantico.
  3. Name it something like Bantico.
  4. Copy the generated token.
  5. Open your Bantico project settings.
  6. Go to Integrations.
  7. Click Connect for Polar.
  8. Paste the access token.
  9. Save the integration.

After that, Bantico can start using Polar payment outcomes in your attribution reporting.

Bantico uses visitor and session cookies to persist attribution on the same site. If you need consent-first behavior for EU users, only load Bantico after consent is granted.

There is no separate data-persist flag in the current Bantico loader. Use the normal Bantico script and gate when you load it.
index.html
1<script>2  window.BANTICO_TOKEN = "YOUR_TOKEN";3</script>4<script src="https://app.bantico.com/bantico.js"></script>

How attribution works

When a Polar payment arrives, Bantico tries to resolve attribution using the strongest available context.

  1. Polar checkout metadata
  2. Tracked-link and campaign context already present on the session
  3. Identified user data such as email, if available

The most reliable setup is always sending Bantico context directly into Polar checkout metadata when you create the checkout session.

Polar checkout metadata

When creating a Polar checkout on your server, pass Bantico attribution context into metadata.

app/api/checkout/route.ts
1import { Polar } from "@polar-sh/sdk";2 3const polar = new Polar({ accessToken: process.env.POLAR_ACCESS_TOKEN! });4 5export async function POST(request: Request) {6  const { productId, bantico } = await request.json();7 8  const checkout = await polar.checkouts.create({9    product_id: productId,10    success_url: "https://yourapp.com/success",11    metadata: {12      linkId: bantico?.linkId || "",13      campaignId: bantico?.campaignId || "",14      source: bantico?.source || "",15      medium: bantico?.medium || "",16      content: bantico?.content || "",17      leadId: bantico?.leadId || "",18    },19  });20 21  return Response.json({ url: checkout.url });22}

These metadata fields should match the same Bantico context you use in tracked links and events: linkId, campaignId, source, medium, content, and leadId.

Email fallback with identify

If a checkout is missing full link metadata, Bantico can still use identified user data as fallback context.

Call bantico.identify() when the user signs in or becomes known:

app/page.tsx
1bantico.identify({2  id: "user_123",3  email: "jane@example.com",4  name: "Jane Smith",5});

Direct Polar checkout metadata is still the preferred setup. Identify-based fallback is helpful, but it should not replace proper checkout metadata.

Learn more about identifying users.

Troubleshooting

If Polar payments are showing up but attribution looks wrong, check the following:

  1. You pass Bantico metadata when creating the checkout session.
  2. The metadata values match the same tracked link, campaign, source, medium, content, and lead context used elsewhere in Bantico.
  3. Polar is connected in your Bantico project settings.
  4. If you use consent-gated loading, Bantico only loads after consent.
  5. Your checkout flow actually sends the metadata to Polar on the server.

If everything looks correct and attribution is still off, contact support with an example checkout or payment so it's easier to debug.