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

# Tracking event payload examples

> Example payloads for tracking events including customer identification, purchase amounts, and event referencing

These examples show request bodies for
[`POST /businesses/{id}/track`](https://docs.pocketflows.com/api-reference/events/track-an-event-occuring-within-a-business).
The event identifier is sent as top-level `event`. Customer identifiers,
purchase amounts, and other event fields are sent inside top-level `data`.

> [!NOTE]
>
> Create or find the project-defined event in [Project Defined
> Events](https://dashboard.pocketflows.com/project_defined_events). For example, an event named
> `purchase_completed` corresponds to a project-defined event with a public ID like `pde_XXXX`. Send
> either that public ID or the event name, `purchase_completed`, as the top-level `event` in the
> payload. The examples below use the ID. Configure `purchase_amount_path` on that project-defined
> event; Pocketflows resolves the path inside the event `data`.

## Customer Identification

### Option 1: Customer ID as a string

```json theme={null}
{
  "event": "pde_XXXX",
  "data": {
    "customer": "cust_abc123"
  }
}
```

### Option 2: Customer as an object with id

```json theme={null}
{
  "event": "pde_XXXX",
  "data": {
    "customer": {
      "id": "cust_abc123"
    }
  }
}
```

### Option 3: Customer as an object with external\_id

Use the `external_id` you set when syncing the customer.

```json theme={null}
{
  "event": "pde_XXXX",
  "data": {
    "customer": {
      "external_id": "your_customer_id"
    }
  }
}
```

### Option 4: Customer external ID as a string

```json theme={null}
{
  "event": "pde_XXXX",
  "data": {
    "customer_external_id": "your_customer_id"
  }
}
```

If `customer` is present, `customer_external_id` is ignored.

## Purchase Amount

The shape of the payload depends on your `purchase_amount_path` configuration.
The path is resolved inside the event `data`.

### Flat key — `purchase_amount_path: "order_amount"`

```json theme={null}
{
  "event": "pde_XXXX",
  "data": {
    "customer": "cust_abc123",
    "order_amount": 49.99
  }
}
```

### Nested key — `purchase_amount_path: "order.amount"`

```json theme={null}
{
  "event": "pde_XXXX",
  "data": {
    "customer": "cust_abc123",
    "order": {
      "amount": 49.99
    }
  }
}
```

### Deeply nested — `purchase_amount_path: "order.total.amount"`

```json theme={null}
{
  "event": "pde_XXXX",
  "data": {
    "customer": "cust_abc123",
    "order": {
      "total": {
        "amount": 49.99
      }
    }
  }
}
```


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