> For the complete documentation index, see [llms.txt](https://developers.airship.co.uk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.airship.co.uk/basics/contacts/append-purchase-history.md).

# Append purchase history

### Overview

Airship can store full purchase history for contact records.

This is useful to measure customer value and target recent or lapsed visitors based on their purchase history.

### Storing purchase history

To store purchase history, simply append a `purchases` object to your contact as you send it to us.

| Field           | Notes                                                                                                                                                                                                                     |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| provider\_id    | This is the partners ID to help identify the source of a purchase. If you need one creating, please contact <support@airship.co.uk>, we'll get one added and provide you an ID                                            |
| order\_type\_id | <p>The order type relating to how the purchase was made;</p><p></p><p>1 = Unknown </p><p>2 = Pay at table </p><p>3 = Click and Collect </p><p>4 = Dine in </p><p>5 = Delivery </p><p>6 = Online Shop </p><p>7 = Other</p> |

```javascript
"account_id": 3,
"email: "johnsmith@gmail.com",
//...etc...

"purchases": [
    {
      "transaction_reference": "77FF-24FF-234F-77FF",
      "unit_id": 8775,
      "created_at": "2021-06-01 00:00:00",
      "provider_id": 1,
      "order_type_id": 4,
      "items": [
        {
          "description": "Negroni",
          "sku": "abc_8913", // string SKU for this product
          "quantity": 1, // qty of this item
          "value": 7 // total value (quantity x item value) in decimal
        },
        {
          "description": "Garlic Bread",
          "sku": "5621",
          "quantity": 2,
          "value": 8.40
        }
      ]
    }
]
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developers.airship.co.uk/basics/contacts/append-purchase-history.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
