> For the complete documentation index, see [llms.txt](https://fredhopper.gitbook.io/product-discovery/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fredhopper.gitbook.io/product-discovery/resources/archived-pages/the-tracking-api-and-js-library/what-to-track/generic-actions/purchase.md).

# Purchase

When your user decides to perform a purchase, you should send a **purchase** action for every item they are purchasing, but you can specify the **quantity** of the item purchased. Purchase events are mostly used to calculate **purchase** conversion rates, and revenues.

```javascript
const purchaseAction = {
    "action":"purchase",
    "target": {
        "product":"83647582"
    },
    "metadata": {
        "orderId": "ec1851da-bff2-495c-b757-c162d9a079bd",
        "price": 3250,
        "quantity": 2,
        "currency": "EUR",
        "locale": "en_GB"
    }
}

xo.activity.send(purchaseAction);
```

The properties needed for sending a **purchase** event are as follows:

* `action` - you need to specify the action as **purchase**
* `target.product` - you need to specify the product id of the product that is purchased. If you are implementing an **FHR** integration, this would be equal to the `secondId` available in the **FHR query** response.
* `metadata.quantity` - you need to specify the quantity of the item purchased.
* `metadata.price` - you need to specify the price of the product purchased - **in cents** (i.e. no decimal spaces)**.**
* `metadata.currency` - the **currency** of the price, in *\*\**[ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) format.
* `locale` - the locale selected by the user.

Any additional information you wish to send(other than **quantity**, **price,** and **currency**) can also be included in the `metadata` \_\*\*\_object. Typical extra information for purchase events:

* `metadata.orderId` - the **order id** from your system.

{% hint style="info" %}
**Important!** Don't forget, you need to send a separate event for every item.
{% endhint %}
