# Count your Paddle sales

> Link every Paddle sale to the visit that brought it: Paddle buttons are tagged for you, checkouts from code take one line, and a read-only key lists the sales.

Link every Paddle 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 opens a Paddle checkout from. A Paddle checkout brings no order id back to your site, so a read-only Paddle key is how CentPath sees your sales at all: don't skip step 3.

## 1. Tell CentPath you sell with Paddle

1. In CentPath, open your site and go to **Setup** → **Sales**.
2. Under **How do buyers pay you?**, pick **Paddle**. It covers Paddle.js buttons and checkouts your code opens alike.

## 2. Tag the checkouts your code opens

Paddle buttons need nothing on your pages: the snippet tags each element with the class `paddle_button` when a visitor clicks it, and stores nothing on the visitor's device.

If your code opens the checkout with `Paddle.Checkout.open()`, add this line to what it passes:

```js
customData: window.analytics?.checkout ? { centpath: window.analytics.checkout() } : undefined,
```

1. Find the call to `Paddle.Checkout.open()` in your code.
2. Add the line inside the object you pass to it. It hands Paddle a one-time reference that ties the sale to the visit, and passes nothing when CentPath's script hasn't loaded or is blocked, so your checkout opens either way.
3. Already passing `customData`? A second `customData` would replace yours, so add this inside your own object instead:

```js
centpath: window.analytics?.checkout?.()
```

## 3. Add a read-only key

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

1. In your Paddle dashboard, go to **My account** → **Settings** → **Authentication**, open the **API keys** tab and click **New API key**.
2. Give it a name and a description you will know it by, like CentPath.
3. Give it one permission, Transactions: read (`transaction.read` in Paddle's API), and nothing else.
4. Set its expiry date as late as Paddle allows: a key that expires stops your sales from syncing until you paste a new one.
5. Click **Save**, then copy the key, which starts with `pdl_live_apikey_`. Paddle shows it only once.
6. In **Setup** → **Sales**, paste it into **Paddle key** under **Read-only key**, then click **Save key**.

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

## Verify the setup

1. Make a real purchase through a Paddle button or your checkout, 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

### Setup says Paddle refused the key

A Paddle key can expire, 90 days after it was made by default, and no retry brings it back. Create a new key as in step 3, paste it into **Paddle key** and click **Save key**.

### Setup says it couldn't reach Paddle

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

### Setup says this is a legacy Paddle key

A key made before 6 May 2025 can't be limited to reading. Create a new key as in step 3.

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

A sandbox key starts with `pdl_sdbx_apikey_` and lists sandbox sales alone; Setup names it with **Sandbox key: only Paddle sandbox sales are listed** under the sync line. A live key lists your real sales alone. 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 your code opened the checkout without the line from step 2. 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.
