> For the complete documentation index, see [llms.txt](https://developers.usetoggle.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.usetoggle.com/webhooks/events/order.created.md).

# Order.created

This event is dispatched an order in Toggle is created.

Orders are created in all instances where a card is initially created e.g. in-venue, free of charge (FOC), web shop, 3rd party etc. An order can contain [one line\_item (e.g. card) or many line\_items](http://academy.usetoggle.com/en/articles/3578378-orders-cards-and-balance-adjustments). However, an order will always only have one transaction associated with it.

Typically, the transaction on an order will be the payment transaction that was used to create that order. Note that in some cases the transaction value won’t be the same as the order value, such as in discounted or FOC orders. Also note that the order value includes the postage value – in the case of postal cards.

For each line\_item – as you can see in the example payload below – you can check which product and/or method of fulfilment was defined for each item in the order.

### Example payload

```javascript
{
  "id": 570,
  "object": "event",
  "api_version": "3.2",
  "webhook_version": "1.0",
  "created_at": "2021-04-11T16:01:27.000000Z",
  "type": "order.created",
  "data": {
    "object": {
      "object": "order",
      "id": 350,
      "postage_value": 0,
      "value": 1000,
      "account_id": 1,
      "transaction": {
        "object": "transaction",
        "id": 617,
        "value": 0,
        "transaction_discount_value": 1000,
        "account_id": 1,
        "currency": {
          "object": "currency",
          "id": 1,
          "name": "Sterling",
          "denomination": 100,
          "iso_currency_code": "GBP"
        },
        "unit": null
      },
      "receipt_contact": {
        "object": "contact",
        "id": 703,
        "email": "john@example.co.uk",
        "first_name": "John",
        "last_name": "Smith",
        "phone_number": null,
        "marketing_opt_in_at": null
      },
      "line_items": [
        {
          "object": "line_item",
          "id": 623,
          "personalised_message": null,
          "value": 1000,
          "line_item_type": {
            "object": "line_item_type",
            "id": 1,
            "name": "Sale"
          },
          "product": {
            "object": "product",
            "id": 4,
            "name": "Gift Card",
            "short_description": "Gift Card",
            "long_description": "Gift Card",
            "image": {
              "object": "image",
              "id": 13,
              "url": "https://apimytoggleio-dev.airship.co.uk//storage/images/1_1616686008.png"
            },
            "product_type": {
              "object": "product_type",
              "id": 1,
              "name": "Gift Card"
            }
          },
          "card": {
            "object": "card",
            "id": 355,
            "balance": 1000,
            "card_reference": "6301190045888067809",
            "pin": "134702",
            "expiry_time": "2021-03-27T23:59:59.000000Z",
            "validity_start_time": "2021-03-12T00:00:00.000000Z",
            "personal_message": null,
            "qr_code_url": "https://apimytoggleio-dev.airship.co.uk/qrcodegenerator/6301190045888067809",
            "account_id": 1,
            "purchaser_contact": {
              "object": "contact",
              "id": 703,
              "email": "john@example.co.uk",
              "first_name": "John",
              "last_name": "Smith",
              "phone_number": null,
              "marketing_opt_in_at": null
            },
            "contact": null,
            "card_alias": {
               "object": "card_alias",
               "card_alias": "18347923487",
               "card_alias_pin": "1234",
            }
          },
          "line_item_fulfilment": {
            "object": "line_item_fulfilment",
            "id": 350,
            "tracking_reference": null,
            "postage_type": null,
            "address": null,
            "contact": {
              "object": "contact",
              "id": 704,
              "email": "john@example.co.uk",
              "first_name": null,
              "last_name": null,
              "phone_number": null,
              "marketing_opt_in_at": null
            },
            "fulfilment_method": {
              "object": "fulfilment_method",
              "id": 1,
              "name": "Email"
            }
          }
        }
      ]
    }
  }
}
```


---

# 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.usetoggle.com/webhooks/events/order.created.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.
