# Connect Paddle: setup guide

Add a Paddle notification destination, let checkout buttons carry the visitor id or pass it as customData with Paddle.js, and see how refunds are counted.

This is the setup. What attribution gives you with Paddle, which checkouts carry the visitor id, and how renewals and refunds count is on the [Paddle revenue attribution page](https://supranalytics.app/integrations/paddle).

**1. Add a notification destination in Paddle**

In Paddle, Developer tools → Notifications → New destination. Choose **Webhook** and this URL (your website id is in Settings → General):

```
https://supranalytics.app/api/webhooks/paddle/YOUR_WEBSITE_ID
```

Select `transaction.completed`, `adjustment.created` and `adjustment.updated`.

**2. Paste the secret key in SuprAnalytics**

Copy the destination's secret key (`pdl_ntfset_…`) into Settings → Revenue with Paddle selected, and save.

**3. Pass the visitor id as custom data**

**Checkout buttons** (`class="paddle_button"`) need nothing: the SuprAnalytics script adds `supr_visitor_id` and `supr_session_id` to their `data-custom-data`, keeping any custom data you set. Add `supr-paddle="false"` to the script to stop it.

Opening checkouts with **Paddle.js**? Pass them as `customData`:

```
Paddle.Checkout.open({
  items: [{ priceId: "pri_123", quantity: 1 }],
  customData: {
    supr_visitor_id: window.supr.visitorId(),
    supr_session_id: window.supr.sessionId(),
  },
});
```

Creating transactions with the API? Put them in the transaction's `custom_data`.

## What SuprAnalytics counts

- **Revenue** is the transaction's total less tax: after discounts, before tax. Paddle is the merchant of record, so tax isn't your revenue. Free transactions are skipped.
- **Renewals**: transactions a subscription creates (renewals, upgrades, one-off charges) count as renewals. Paddle copies the checkout's custom data to the subscription and its renewals, and SuprAnalytics also matches Paddle's customer id, so they keep the customer's original visitor.
- **Refunds** and chargebacks count once Paddle **approves** them: a full one marks the payment refunded, a partial one lowers it by its pre-tax amount. Each is applied once.
- Signatures (`Paddle-Signature`) are checked against your secret key; retries are safe.

> **Testing**
>
> Test on a second website, not your real one: each website keeps one Paddle secret key, and test payments sent to a real website stay in its revenue (payments can't be deleted). Add a website for your staging site (websites are unlimited), with its own script, point a destination in Paddle's **sandbox** at that website's URL, paste the sandbox's secret key into that website's Settings → Revenue, and pay with a test card.

---

This page on the web: https://supranalytics.app/docs/paddle
Every documentation page: https://supranalytics.app/docs.md
