> For the complete documentation index, see [llms.txt](https://developer.esw.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.esw.com/order-api/resources/order-allocation-event.md).

# Order Allocation Event

The Order Allocation event allows our clients to consume the latest order details for\
their shoppers orders. The event is triggered when all the items in an order have\
been assigned a status of either “Allocated” or “Cancelled”.

A brand may use our multi origin ability, where the origin of products can change\
after the checkout process. In this case, ESW will wait for allocation updates via the\
allocate API. When the status of each item is confirmed, the event will be triggered\
to the client specific end point.

Note, if there is a change to the origin of any article, the order will be recalculated\
for updated duties and taxes and the allocation event will be published.\
Where a brand does not want to use multi origin, the allocation event will still be\
triggered (items will be automatically allocated) with the original duties and taxes\
values. The event will be triggered to the client specific end point.

<details>

<summary>Example Payload</summary>

{% code expandable="true" %}

```json
{
	"TenantCode": "GOCAS",
	"BrandOrderReference": "GOC25031434046724JP-3",
	"TransactionReference": "1abc2d1c-b9bc-495b-a437-6395434ba187",
	"LineItems": [
		{
			"Quantity": 4,
			"ProductCode": "123456789",
			"LineItemId": 1,
			"Articles": [
				{
					"Id": "5974b83e-c121-43f8-8d71-93edcf545a1d",
					"Sequence": 1,
					"AllocationStatus": "Allocated",
					"FulfilmentCountryIso": "IT",
					"FulfilmentCenterId": "GOCAS-IT-001",
					"Charges": {
						"SubTotal": {
							"shopper": {
								"currency": "JPY",
								"amount": 2479
							},
							"retailer": {
								"currency": "USD",
								"amount": 16.22
							}
						},
						"Delivery": {
							"shopper": {
								"currency": "JPY",
								"amount": 454
							},
							"retailer": {
								"currency": "USD",
								"amount": 2.97
							}
						},
						"DeliveryDuties": {
							"shopper": {
								"currency": "JPY",
								"amount": 46
							},
							"retailer": {
								"currency": "USD",
								"amount": 0.3
							}
						},
						"OtherTaxes": {
							"shopper": {
								"currency": "JPY",
								"amount": 0
							},
							"retailer": {
								"currency": "USD",
								"amount": 0
							}
						},
						"Duty": {
							"shopper": {
								"currency": "JPY",
								"amount": 248
							},
							"retailer": {
								"currency": "USD",
								"amount": 1.62
							}
						},
						"DeliveryTaxes": {
							"shopper": {
								"currency": "JPY",
								"amount": 50
							},
							"retailer": {
								"currency": "USD",
								"amount": 0.32
							}
						},
						"Taxes": {
							"shopper": {
								"currency": "JPY",
								"amount": 273
							},
							"retailer": {
								"currency": "USD",
								"amount": 1.78
							}
						}
					}
				},
				{
					"Id": "855aa152-eacd-49a8-9810-3514c45dd666",
					"Sequence": 2,
					"AllocationStatus": "Allocated",
					"FulfilmentCountryIso": "IT",
					"FulfilmentCenterId": "GOCAS-IT-001",
					"Charges": {
						"SubTotal": {
							"shopper": {
								"currency": "JPY",
								"amount": 2479
							},
							"retailer": {
								"currency": "USD",
								"amount": 16.22
							}
						},
						"Delivery": {
							"shopper": {
								"currency": "JPY",
								"amount": 455
							},
							"retailer": {
								"currency": "USD",
								"amount": 2.98
							}
						},
						"DeliveryDuties": {
							"shopper": {
								"currency": "JPY",
								"amount": 45
							},
							"retailer": {
								"currency": "USD",
								"amount": 0.29
							}
						},
						"OtherTaxes": {
							"shopper": {
								"currency": "JPY",
								"amount": 0
							},
							"retailer": {
								"currency": "USD",
								"amount": 0
							}
						},
						"Duty": {
							"shopper": {
								"currency": "JPY",
								"amount": 248
							},
							"retailer": {
								"currency": "USD",
								"amount": 1.62
							}
						},
						"DeliveryTaxes": {
							"shopper": {
								"currency": "JPY",
								"amount": 51
							},
							"retailer": {
								"currency": "USD",
								"amount": 0.33
							}
						},
						"Taxes": {
							"shopper": {
								"currency": "JPY",
								"amount": 272
							},
							"retailer": {
								"currency": "USD",
								"amount": 1.78
							}
						}
					}
				},
				{
					"Id": "fbd56393-501b-47e6-8569-f732318914ed",
					"Sequence": 3,
					"AllocationStatus": "Allocated",
					"FulfilmentCountryIso": "IT",
					"FulfilmentCenterId": "GOCAS-IT-001",
					"Charges": {
						"SubTotal": {
							"shopper": {
								"currency": "JPY",
								"amount": 2479
							},
							"retailer": {
								"currency": "USD",
								"amount": 16.22
							}
						},
						"Delivery": {
							"shopper": {
								"currency": "JPY",
								"amount": 455
							},
							"retailer": {
								"currency": "USD",
								"amount": 2.98
							}
						},
						"DeliveryDuties": {
							"shopper": {
								"currency": "JPY",
								"amount": 45
							},
							"retailer": {
								"currency": "USD",
								"amount": 0.29
							}
						},
						"OtherTaxes": {
							"shopper": {
								"currency": "JPY",
								"amount": 0
							},
							"retailer": {
								"currency": "USD",
								"amount": 0
							}
						},
						"Duty": {
							"shopper": {
								"currency": "JPY",
								"amount": 248
							},
							"retailer": {
								"currency": "USD",
								"amount": 1.62
							}
						},
						"DeliveryTaxes": {
							"shopper": {
								"currency": "JPY",
								"amount": 50
							},
							"retailer": {
								"currency": "USD",
								"amount": 0.33
							}
						},
						"Taxes": {
							"shopper": {
								"currency": "JPY",
								"amount": 273
							},
							"retailer": {
								"currency": "USD",
								"amount": 1.78
							}
						}
					}
				},
				{
					"Id": "d5a18ccc-b880-4720-b073-c1511464255c",
					"Sequence": 4,
					"AllocationStatus": "Allocated",
					"FulfilmentCountryIso": "IT",
					"FulfilmentCenterId": "GOCAS-IT-001",
					"Charges": {
						"SubTotal": {
							"shopper": {
								"currency": "JPY",
								"amount": 2480
							},
							"retailer": {
								"currency": "USD",
								"amount": 16.23
							}
						},
						"Delivery": {
							"shopper": {
								"currency": "JPY",
								"amount": 454
							},
							"retailer": {
								"currency": "USD",
								"amount": 2.97
							}
						},
						"DeliveryDuties": {
							"shopper": {
								"currency": "JPY",
								"amount": 46
							},
							"retailer": {
								"currency": "USD",
								"amount": 0.3
							}
						},
						"OtherTaxes": {
							"shopper": {
								"currency": "JPY",
								"amount": 0
							},
							"retailer": {
								"currency": "USD",
								"amount": 0
							}
						},
						"Duty": {
							"shopper": {
								"currency": "JPY",
								"amount": 248
							},
							"retailer": {
								"currency": "USD",
								"amount": 1.62
							}
						},
						"DeliveryTaxes": {
							"shopper": {
								"currency": "JPY",
								"amount": 49
							},
							"retailer": {
								"currency": "USD",
								"amount": 0.32
							}
						},
						"Taxes": {
							"shopper": {
								"currency": "JPY",
								"amount": 273
							},
							"retailer": {
								"currency": "USD",
								"amount": 1.78
							}
						}
					}
				}
			]
		}
	],
	"Charges": {
		"Total": {
			"shopper": {
				"currency": "JPY",
				"amount": 9917
			},
			"retailer": {
				"currency": "USD",
				"amount": 64.89
			}
		},
		"Delivery": {
			"shopper": {
				"currency": "JPY",
				"amount": 1818
			},
			"retailer": {
				"currency": "USD",
				"amount": 11.9
			}
		},
		"DeliveryDuties": {
			"shopper": {
				"currency": "JPY",
				"amount": 182
			},
			"retailer": {
				"currency": "USD",
				"amount": 1.19
			}
		},
		"DeliveryTaxes": {
			"shopper": {
				"currency": "JPY",
				"amount": 200
			},
			"retailer": {
				"currency": "USD",
				"amount": 1.31
			}
		},
		"Taxes": {
			"shopper": {
				"currency": "JPY",
				"amount": 1091
			},
			"retailer": {
				"currency": "USD",
				"amount": 7.14
			}
		},
		"OtherTaxes": {
			"shopper": {
				"currency": "JPY",
				"amount": 0
			},
			"retailer": {
				"currency": "USD",
				"amount": 0
			}
		},
		"Duty": {
			"shopper": {
				"currency": "JPY",
				"amount": 992
			},
			"retailer": {
				"currency": "USD",
				"amount": 6.49
			}
		}
	}
}
```

{% endcode %}

</details>

<details>

<summary>Allocation Event Attributes</summary>

| Field Name                       | Description                                          | Field Type          | Example of Data                                                                                      |
| -------------------------------- | ---------------------------------------------------- | ------------------- | ---------------------------------------------------------------------------------------------------- |
| brandOrderReference              | Unique reference for the order assigned by the brand | String              | "GOC25031434046724JP-3"                                                                              |
| lineItems                        | List of items in the order                           | Array               | \[ {...} ]                                                                                           |
| lineItems\[].quantity            | Quantity of the product ordered                      | Integer             | 4                                                                                                    |
| lineItems\[].productCode         | Unique identifier for the product                    | String              | "123456789"                                                                                          |
| lineItems\[].lineItemId          | Unique identifier for the line item                  | String              | "1"                                                                                                  |
| lineItems\[].articles            | List of articles related to the line item            | Array               | \[ {...} ]                                                                                           |
| articles\[].id                   | Unique identifier for the article                    | String (UUID)       | "5974b83e-c121-43f8-8d71-93edcf545a1d"                                                               |
| articles\[].sequence             | Sequence number of the article                       | Integer             | 1                                                                                                    |
| articles\[].allocationStatus     | Status of the article allocation                     | String              | "Allocated"                                                                                          |
| articles\[].fulfilmentCountryIso | Country code where fulfillment occurs                | String (ISO 3166-1) | "IT"                                                                                                 |
| articles\[].fulfilmentCenterId   | Unique ID of the fulfillment center                  | String (UUID)       | "GOCAS-IT-001"                                                                                       |
| articles\[].charges              | Charges related to the article                       | Object              | { ... }                                                                                              |
| charges.subTotal                 | Total item price before taxes and fees               | Object              | { "shopper": {"currency": "JPY", "amount": 2479}, "retailer": {"currency": "USD", "amount": 16.22} } |
| charges.delivery                 | Delivery cost                                        | Object              | { "shopper": {"currency": "JPY", "amount": 454}, "retailer": {"currency": "USD", "amount": 2.97} }   |
| charges.deliveryDuty             | Duties related to delivery                           | Object              | { "shopper": {"currency": "JPY", "amount": 46}, "retailer": {"currency": "USD", "amount": 0.3} }     |

</details>

#### Other Definitions <a href="#other-definitions" id="other-definitions"></a>

The order allocation event also breaks down the values in both Shopper and\
Retailer currency. Please see definition of both below:

| Term              | Definition                                              |
| ----------------- | ------------------------------------------------------- |
| Shopper Currency  | The currency in which the shopper pays for their order. |
| Retailer Currency | The currency that the Retailer settles in.              |


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.esw.com/order-api/resources/order-allocation-event.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
