> ## 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) via your referral link.

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

  <ParamField body="click" type="object">
    The click event that led to the sale.

    <Expandable title="click object">
      <ParamField body="id" type="string">
        Unique identifier for the click.
      </ParamField>

      <ParamField body="timestamp" type="string">
        ISO 8601 timestamp when the click occurred.
      </ParamField>

      <ParamField body="url" type="string">
        Destination URL of the click.
      </ParamField>

      <ParamField body="country" type="string">
        Country code.
      </ParamField>

      <ParamField body="city" type="string">
        City name.
      </ParamField>

      <ParamField body="region" type="string">
        Region or datacenter identifier.
      </ParamField>

      <ParamField body="continent" type="string">
        Continent code.
      </ParamField>

      <ParamField body="device" type="string">
        Device type (e.g. <code>Desktop</code>).
      </ParamField>

      <ParamField body="browser" type="string">
        Browser name.
      </ParamField>

      <ParamField body="os" type="string">
        Operating system.
      </ParamField>

      <ParamField body="referer" type="string">
        Referrer source.
      </ParamField>

      <ParamField body="refererUrl" type="string">
        Referrer URL.
      </ParamField>

      <ParamField body="qr" type="boolean">
        Whether the click came from a QR code.
      </ParamField>

      <ParamField body="ip" type="string">
        IP address of the click.
      </ParamField>
    </Expandable>
  </ParamField>

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

    <Expandable title="link object">
      <ParamField body="id" type="string">
        Unique identifier for the link.
      </ParamField>

      <ParamField body="shortLink" type="string">
        The short link URL.
      </ParamField>

      <ParamField body="domain" type="string">
        Domain of the short link.
      </ParamField>

      <ParamField body="key" type="string">
        Unique key of the short link.
      </ParamField>
    </Expandable>
  </ParamField>

  <ParamField body="customer" type="object">
    The customer that made the purchase.

    <Expandable title="customer object">
      <ParamField body="id" type="string">
        Unique identifier for the customer.
      </ParamField>

      <ParamField body="country" type="string">
        Country code.
      </ParamField>

      <ParamField body="createdAt" type="string">
        ISO 8601 timestamp when the customer was first seen.
      </ParamField>

      <ParamField body="firstSaleAt" type="string | null">
        ISO 8601 timestamp of the customer's first sale, if any.
      </ParamField>

      <ParamField body="subscriptionCanceledAt" type="string | null">
        ISO 8601 timestamp when the subscription was canceled, if any.
      </ParamField>
    </Expandable>
  </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>
    </Expandable>
  </ParamField>
</WebhookResponseBodyParameters>

<ResponseExample>
  ```json Response theme={null}
  {
    "id": "evt_WHjyHhqsfYOrlJOOVJSoHXysD",
    "event": "sale.created",
    "createdAt": "2025-07-16T10:48:02.000Z",
    "data": {
      "eventName": "Subscription",
      "click": {
        "id": "GWGrkftJdYlZD2mq",
        "timestamp": "2025-02-03T09:35:57.926Z",
        "url": "https://github.com/dubinc/dub",
        "country": "US",
        "city": "San Jose",
        "region": "sfo1",
        "continent": "NA",
        "device": "Desktop",
        "browser": "Chrome",
        "os": "Mac OS",
        "referer": "(direct)",
        "refererUrl": "(direct)",
        "qr": false,
        "ip": "198.51.100.42"
      },
      "link": {
        "id": "cm0lcuvtz000xcutmqw4a7wi3",
        "shortLink": "https://dub.sh/track-test",
        "domain": "dub.sh",
        "key": "track-test"
      },
      "customer": {
        "id": "cus_1K09DJDEACR47NPYC93RM43WF",
        "country": "US",
        "createdAt": "2025-07-16T10:48:01.739Z",
        "firstSaleAt": "2025-07-18T10:48:01.739Z",
        "subscriptionCanceledAt": null
      },
      "sale": {
        "amount": 100,
        "currency": "usd"
      }
    }
  }
  ```
</ResponseExample>
