# Sales

How Paddle sales become Purchase events, how refunds change them, and how to tie each sale to the ad that brought it.

Each sale on the connected account becomes one `Purchase` event worth what the buyer paid, net of refunds. It counts in [campaign results](/guides/campaign-results) and [ad rules](/guides/ad-rules) once it is tied to a campaign.

## Tie a sale to its ad

Pass the visitor id the [Zernio tag](/products/server-side-tracking) keeps in its `_zid` cookie in the checkout's `customData` as `zernio_visitor_id`; Zernio then adds the click ids of that visit.

You can also pass the visit's `zrn`, `gclid`, `fbclid` and `utm_*` keys, and `landing_url` for the page it landed on.

```javascript
Paddle.Checkout.open({
  items: [{ priceId: "pri_123", quantity: 1 }],
  customData: {
    zernio_visitor_id: getCookie("_zid"),
    utm_campaign: "fall-sale"
  }
});
```

With the API, set the same keys in the transaction's `custom_data`. A sale without any of these is still stored and counts in totals, but not on a campaign.

## Read the sales

Paddle sales are events with source `paddle`. Read them with `GET /v1/events?source=paddle`, or per campaign in campaign results. On **Connections**, **View sales** on the account lists the latest ones with their campaign.

Each event's `eventId` is `paddle:` followed by the Zernio account id and the Paddle transaction id (`txn_...`).

## Send sales to ad platforms

Off by default. Turn it on with **Send to ad platforms** in **View sales**, or:

```bash
curl -X PATCH "https://zernio.com/api/v1/accounts/ACCOUNT_ID/paddle-settings" \
  -H "Authorization: Bearer $ZERNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "forwardSales": true }'
```

Only sales paid after you turn it on are sent, through the profile's [forwarding rules](/conversions/create-forwarding-rule) that take the `paddle` source:

| Sale | Sent as |
|---|---|
| A one-off sale (a checkout without a subscription) | `Purchase` |
| A subscription's first payment, started at checkout | `Subscribe`, not also `Purchase`, so a platform never counts it twice |
| A renewal, a plan change or a refund | Nothing |

## How it behaves

- A transaction counts when Paddle marks it completed. Its value is the grand total the buyer paid, tax included.
- A refund counts once Paddle approves it: the sale is stored again at what the buyer kept. A full refund retracts it.
- A transaction that took no money, such as the start of a free trial, is not a sale. The first payment after the trial counts as the new subscriber.
- The amount keeps the transaction's currency. Campaign results convert it to the ad account's currency.

## Related

- [Conversions API](/products/conversions-api)
- [Campaign results](/guides/campaign-results)