> ## 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

export const WebhookResponseBodyParameters = ({type, children}) => <div>
    <h2>Response body parameters</h2>
    <p>
      All webhook payloads follow a consistent top-level structure with
      event-specific data nested within the <code>data</code> object.
    </p>
    <ParamField body="id" type="string">
      The event ID.
    </ParamField>
    <ParamField body="event" type="string">
      The event type that triggered the webhook (e.g., <code>{type}</code>).
    </ParamField>
    <ParamField body="createdAt" type="string">
      ISO 8601 timestamp when the webhook event was created.
    </ParamField>
    <ParamField body="data" type="object">
      Event-specific data containing detailed information about the event. The
      data object for the <code>{type}</code> event contains the following
      parameters:
      <Expandable defaultOpen title="object parameters">
        {children}
      </Expandable>
    </ParamField>
  </div>;

Event triggered when a [new sale is tracked](/docs/api-reference/track/sale).

<WebhookResponseBodyParameters type="sale.created">
  <ParamField body="eventName" type="string">
    Name of the tracked event (e.g. <code>Purchased</code>).
  </ParamField>

  <ParamField body="customer" type="object">
    The customer that made the purchase (id, name, email, avatar).
  </ParamField>

  <ParamField body="click" type="object">
    The click event that led to the sale (id, url, ip, continent, country, city, device, browser, os, ua, bot, qr, referer).
  </ParamField>

  <ParamField body="link" type="object">
    The referral link the sale is associated with (full link object).
  </ParamField>

  <ParamField body="partner" type="object | null">
    Partner details. Only present when the link is a partner referral link.
  </ParamField>

  <ParamField body="sale" type="object">
    Details about the recorded sale.

    <Expandable title="sale object">
      <ParamField body="amount" type="number">
        Sale amount in cents.
      </ParamField>

      <ParamField body="currency" type="string">
        Currency code (e.g. <code>usd</code>).
      </ParamField>

      <ParamField body="paymentProcessor" type="string">
        Payment processor used (e.g. <code>stripe</code>).
      </ParamField>

      <ParamField body="invoiceId" type="string | null">
        External invoice ID, if any.
      </ParamField>
    </Expandable>
  </ParamField>

  <ParamField body="metadata" type="object | null">
    Optional metadata associated with the sale event.
  </ParamField>
</WebhookResponseBodyParameters>

<ResponseExample>
  ```json Response theme={null}
  {
    "id": "evt_WHjyHhqsfYOrlJOOVJSoHXysD",
    "event": "sale.created",
    "createdAt": "2024-08-30T09:57:51.245Z",
    "data": {
      "eventName": "Purchased",
      "customer": {
        "id": "cm0gjdvr20001dkbha2n9gt2b",
        "name": "John",
        "email": "john@example.com",
        "avatar": "https://example.com/john.jpeg"
      },
      "click": {
        "id": "d0UtZqE0BZuBPrJS",
        "url": "https://github.com/dubinc/dub",
        "ip": "63.141.57.109",
        "continent": "NA",
        "country": "US",
        "city": "San Francisco",
        "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",
        "bot": false,
        "qr": false,
        "referer": "(direct)"
      },
      "link": {
        "id": "cm0faqkyn0001txvfwjfeq7gl",
        "domain": "dub.sh",
        "key": "79ys3WA",
        "externalId": null,
        "url": "https://github.com/dubinc/dub",
        "trackConversion": true,
        "archived": false,
        "expiresAt": null,
        "expiredUrl": 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,
        "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,
        "sales": 1,
        "saleAmount": 20000,
        "createdAt": "2024-08-29T13:03:59.098Z",
        "updatedAt": "2024-08-30T09:57:50.891Z",
        "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
    }
  }
  ```
</ResponseExample>
