# Count your Polar sales

> Link every Polar sale to the visit that brought it: mark your success URL, and add a read-only access token for amounts and renewals.

Link every Polar sale to the visit that brought it, so your dashboard shows which sources bring paying customers.

## Before you start

[Install CentPath](https://centpath.app/docs/install) first, on every page a buyer starts a checkout from and on your success page.

## 1. Tell CentPath you sell with Polar

1. In CentPath, open your site and go to **Setup** → **Sales**.
2. Under **How do buyers pay you?**, pick **Polar**. It covers checkout links and checkouts your code creates alike.

## 2. Mark your success URL

Add this to the end of the success URL of your checkout links, and of the checkouts your code creates:

```text
?checkout_id={CHECKOUT_ID}
```

1. For a checkout link, open **Catalog** → **Checkout Links** in Polar, then the link, and find its **Success URL** setting. For a checkout your code creates, find the success URL it passes to Polar.
2. Add the line above to its end. If the URL already has a ?, start with & instead.
3. Make sure the success page loads the CentPath snippet: it reads the id when the buyer lands there.

Polar fills in the id, and each sale counts once. Without a Polar key, a sale counts with no amount.

Checkout links need nothing on your pages: the snippet tags each one when a visitor clicks it, and stores nothing on the visitor's device.

## 3. Add a read-only key

With a read-only key we list your Polar sales and renewals and their amounts, even ones whose buyer never came back to your site.

1. In Polar, open **Settings** → **Access Tokens** and click **Create token**.
2. Give it a **Name** you will know it by, like CentPath.
3. Under **Expiration**, pick the longest Polar offers: a token that expires stops your sales from syncing until you paste a new one.
4. Under **Scopes**, select `orders:read` and nothing else.
5. Copy the token, which starts with `polar_oat_`. Polar shows it only once.
6. In **Setup** → **Sales**, paste it into **Polar key** under **Read-only key**, then click **Save key**.

We encrypt it and never show it again. We list your orders and keep only each one's id, amount, currency and time, never who bought.

## Verify the setup

1. Make a real purchase through a checkout link, or wait for your next sale.
2. In **Setup** → **Sales**, the line under the key says when sales last synced. The first sync runs within 10 minutes of saving the key.
3. Open your dashboard and switch the chart to **Revenue**: the sale is there, under the source of the visit that brought it.

## Troubleshooting

### A sale shows with no amount

Without a Polar key, a sale counts as an order with no amount. Add a read-only key, as in step 3, and its amount is read from Polar.

### Setup says Polar refused the key

A Polar token can expire, or be revoked, and no retry brings it back. Create a new token as in step 3, paste it into **Polar key** and click **Save key**.

### Setup says it couldn't reach Polar

The line says why, and CentPath retries on its own. If it says the key needs the scope `orders:read`, create a new token with that scope, as in step 3, and paste it in place of the old one.

### A sale made in Polar's sandbox doesn't show

A token belongs to one Polar environment. A production token lists your real sales alone, and Setup names a sandbox token with **Sandbox key: only Polar sandbox sales are listed** under the sync line. Make a real purchase, or wait for your next sale.

### The dashboard says a sale is not linked to a visit

Nothing ties the sale to a visit: the buyer's browser blocked the script, say, or they paid and never came back to your success page. The sale counts on the line under the figures, never in a source's revenue. [How revenue is counted](https://centpath.app/docs/revenue#sales-not-linked-to-a-visit) explains the line.
