> ## Documentation Index
> Fetch the complete documentation index at: https://dub.co/llms.txt
> Use this file to discover all available pages before exploring further.

# sale.created

Occurs whenever a [sale is created](/docs/api-reference/track/sale).

## Response body parameters

All webhook payloads follow a consistent top-level structure with
event-specific data nested within the `data` object.

**id** `string`

The event ID.
**event** `string`

The event type that triggered the webhook (e.g., `sale.created`).
**createdAt** `string`

ISO 8601 timestamp when the webhook event was created.
**data** `object`

Event-specific data containing detailed information about the event. The
data object for the `sale.created` event contains the following
parameters:

**object parameters**

**eventName** `string`

Name of the tracked event (e.g. `Purchased`).

**customer** `object`

The customer that made the purchase.

**customer object**

**id** `string`

Unique identifier for the customer.

**name** `string`

Customer name.

**email** `string | null`

Customer email address.

**avatar** `string | null`

URL to the customer's avatar image.

**externalId** `string`

Your external customer ID, if provided when tracking.

**stripeCustomerId** `string | null`

The customer's Stripe customer ID, if linked.

**country** `string | null`

The customer's country code.

**sales** `number | null`

Total number of sales for the customer.

**saleAmount** `number | null`

Total sale amount for the customer in cents.

**createdAt** `string`

ISO 8601 timestamp when the customer was first seen.

**firstSaleAt** `string | null`

ISO 8601 timestamp of the customer's first sale.

**subscriptionCanceledAt** `string | null`

ISO 8601 timestamp when the customer canceled their subscription, if applicable.

**click** `object`

The click event that led to the sale.

**click object**

**id** `string`

Unique identifier for the click.

**timestamp** `string`

ISO 8601 timestamp when the click occurred.

**url** `string`

The destination URL that was visited.

**country** `string`

Country code (e.g. `US`).

**city** `string`

City name.

**region** `string`

Region or region code.

**continent** `string`

Continent code (e.g. `NA`).

**device** `string`

Device type (e.g. `Desktop`, `Mobile`).

**browser** `string`

Browser name (e.g. `Chrome`).

**os** `string`

Operating system (e.g. `Mac OS`).

**ua** `string | null`

User agent string.

**trigger** `string | null`

How the click was triggered (e.g. `link`, `qr`, or `deeplink`).

**referer** `string`

Referrer hostname or `(direct)`.

**refererUrl** `string`

Full referrer URL or `(direct)`.

**qr** `boolean`

Whether the click came from a QR code scan.

**ip** `string`

IP address of the visitor.

**link** `object`

The referral link the sale is associated with (full link object).

**partner** `object | null`

Partner details. Only present when the link is a partner referral link.

**sale** `object`

Details about the recorded sale.

**sale object**

**amount** `number`

Sale amount in cents.

**currency** `string`

Currency code (e.g. `usd`).

**paymentProcessor** `string`

Payment processor used (e.g. `stripe`).

**invoiceId** `string | null`

External invoice ID, if any.

**metadata** `object | null`

Optional metadata associated with the sale event.

```json Response theme={null}
{
  "id": "evt_WHjyHhqsfYOrlJOOVJSoHXysD",
  "event": "sale.created",
  "createdAt": "2024-08-30T09:57:51.245Z",
  "data": {
    "eventName": "Purchased",
    "customer": {
      "id": "cus_1K09DJDEACR47NPYC93RM43WF",
      "name": "John",
      "email": "john@example.com",
      "avatar": "https://example.com/john.jpeg",
      "externalId": "",
      "stripeCustomerId": null,
      "country": null,
      "sales": 0,
      "saleAmount": 0,
      "createdAt": "2024-08-30T09:57:51.245Z",
      "firstSaleAt": null,
      "subscriptionCanceledAt": null
    },
    "click": {
      "id": "d0UtZqE0BZuBPrJS",
      "timestamp": "2024-08-30T09:57:51.245Z",
      "url": "https://github.com/dubinc/dub",
      "country": "US",
      "city": "San Francisco",
      "region": "CA",
      "continent": "NA",
      "device": "Desktop",
      "browser": "Chrome",
      "os": "Mac OS",
      "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36",
      "trigger": null,
      "referer": "(direct)",
      "refererUrl": "(direct)",
      "qr": false,
      "ip": "63.141.57.109"
    },
    "link": {
      "id": "cm0faqkyn0001txvfwjfeq7gl",
      "domain": "dub.sh",
      "key": "79ys3WA",
      "url": "https://github.com/dubinc/dub",
      "trackConversion": true,
      "externalId": null,
      "tenantId": null,
      "partnerId": "pn_1JRB6678XHGBZE95R5PH5QVGS",
      "programId": "prog_CYCu7IMAapjkRpTnr8F1azjN",
      "archived": false,
      "expiresAt": null,
      "expiredUrl": null,
      "disabledAt": null,
      "password": null,
      "proxy": false,
      "title": null,
      "description": null,
      "image": null,
      "video": null,
      "rewrite": false,
      "doIndex": false,
      "ios": null,
      "android": null,
      "geo": null,
      "publicStats": false,
      "folderId": null,
      "tagId": null,
      "tags": [],
      "webhookIds": [],
      "comments": null,
      "shortLink": "https://dub.sh/79ys3WA",
      "qrCode": "https://api.dub.co/qr?url=https://dub.sh/79ys3WA?qr=1",
      "utm_source": null,
      "utm_medium": null,
      "utm_campaign": null,
      "utm_term": null,
      "utm_content": null,
      "userId": "cm022rkcw0000ikt14mscg9sg",
      "workspaceId": "ws_cm022sis60003ikt1syy7kfhl",
      "clicks": 10,
      "lastClicked": "2024-08-30T07:45:09.000Z",
      "leads": 5,
      "conversions": 1,
      "sales": 1,
      "saleAmount": 20000,
      "createdAt": "2024-08-29T13:03:59.098Z",
      "updatedAt": "2024-08-30T09:57:50.891Z",
      "projectId": "cm022sis60003ikt1syy7kfhl",
      "testVariants": null,
      "testCompletedAt": null,
      "testStartedAt": null
    },
    "partner": {
      "id": "pn_1JRB6678XHGBZE95R5PH5QVGS",
      "name": "Sarah Johnson",
      "email": "sarah@partner.com",
      "image": "https://example.com/sarah-avatar.jpg",
      "payoutsEnabledAt": null,
      "country": "US",
      "groupId": "grp_1K6K3HD0QE7XTX5HSVR77AK5B",
      "totalClicks": 200,
      "totalLeads": 30,
      "totalConversions": 20,
      "totalSales": 15,
      "totalSaleAmount": 75000,
      "totalCommissions": 7500
    },
    "sale": {
      "amount": 4500,
      "currency": "usd",
      "paymentProcessor": "stripe",
      "invoiceId": null
    },
    "metadata": null
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.