> 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/checkout-api/resources/tutorials/complex-order-confirmation.md).

# Complex Order Confirmation

<details>

<summary>Order Summary</summary>

| Detail            | Value                       |
| ----------------- | --------------------------- |
| Retailer currency | EUR                         |
| Shopper currency  | AUD                         |
| FX rate           | 1.65 (EUR → AUD)            |
| Delivery country  | Australia (`AU`)            |
| Shopper language  | English Australia (`en-AU`) |
| `cartType`        | `Standard`                  |

</details>

<details>

<summary>Products</summary>

| # | Product                | SKU         | HS Code   | Qty | Unit price (EUR) | Unit price (AUD) |
| - | ---------------------- | ----------- | --------- | --- | ---------------- | ---------------- |
| 1 | Classic Leather Wallet | `SKU-00123` | `4202.32` | 1   | €89.95           | AUD 148.42       |
| 2 | Leather Belt           | `SKU-00456` | `4203.30` | 2   | €59.95           | AUD 98.92        |
| 3 | Silk Scarf             | `SKU-00789` | `6214.10` | 1   | €149.00          | AUD 245.85       |

</details>

<details>

<summary>Promotions Applied</summary>

| Code       | Applies to                 | Type         | Value                |
| ---------- | -------------------------- | ------------ | -------------------- |
| `WINTER20` | Scarf only (product-level) | 20% discount | −€29.80 / −AUD 49.17 |
| `LOYALTY5` | Wallet + Belt (cart-level) | 5% discount  | −€10.50 / −AUD 17.33 |

</details>

<details>

<summary>Charges Summary</summary>

| Charge                                 | EUR         | AUD            |
| -------------------------------------- | ----------- | -------------- |
| Goods (before any discounts)           | €358.85     | AUD 592.10     |
| WINTER20 product discount (scarf)      | −€29.80     | −AUD 49.17     |
| LOYALTY5 cart discount (wallet + belt) | −€10.50     | −AUD 17.33     |
| Goods after all discounts              | €318.55     | AUD 525.61     |
| Duty (blended across 3 lines)          | €24.56      | AUD 40.52      |
| Express delivery                       | €18.00      | AUD 29.70      |
| Administration                         | €2.50       | AUD 4.13       |
| **Grand total**                        | **€363.61** | **AUD 599.96** |

</details>

<details>

<summary>Payment Split</summary>

| Method       | AUD amount     |
| ------------ | -------------- |
| Store credit | AUD 100.00     |
| Visa         | AUD 499.96     |
| **Total**    | **AUD 599.96** |

</details>

***

{% stepper %}
{% step %}

### Top-Level Identifiers and Checkout Total

```json
{
  "retailerCartId": "CART-2024-91037",
  "eShopWorldOrderNumber": "ESW-20241115-00091037",
  "deliveryCountryIso": "AU",
  "cartType": "Standard",
  "pricingSynchronizationId": "psync-def789ghi012"
}
```

And the checkout total — the confirmed total in both currencies:

```json
"checkoutTotal": {
  "retailer": { "currency": "EUR", "amount": "363.61" },
  "shopper":  { "currency": "AUD", "amount": "599.96" }
}
```

{% endstep %}

{% step %}

### Promo Codes

The `retailerPromoCodes` array records every code the shopper entered during the checkout session. These are informational — they describe what was entered, not what was applied.&#x20;

Multiple promo codes are applied **first-to-last** in the array order. Place the most specific (product-level) code first and broader (cart-level) codes after.

{% code expandable="true" %}

```json
"retailerPromoCodes": [
  {
    "promoCode": "WINTER20",
    "title": "Winter Sale",
    "description": "20% off selected scarves and shawls"
  },
  {
    "promoCode": "LOYALTY5",
    "title": "Loyalty Reward",
    "description": "5% loyalty discount for registered members"
  }
]
```

{% endcode %}

| Field         | Max length | Description                         |
| ------------- | ---------- | ----------------------------------- |
| `promoCode`   | 50         | The code as entered by the shopper  |
| `title`       | 100        | Short label for the promotion       |
| `description` | 150        | Longer description of the promotion |

All three fields are optional strings. The array itself is optional — but always include it when the shopper applied a code, so ESW's records reflect what was presented at checkout.
{% endstep %}

{% step %}

### Cart-Level Discount (`cartDiscountPriceInfo`)

The LOYALTY5 code reduced the wallet and belt prices by 5%, producing a cart-level discount of €10.50 / AUD 17.33. This is captured in `cartDiscountPriceInfo` on the root of the request.

`PriceInfoRequestDto` requires a `price` (the pre-discount price) and accepts an optional `discounts` array describing the discount(s) applied.

{% code expandable="true" %}

```json
"cartDiscountPriceInfo": {
  "price": {
    "retailer": { "currency": "EUR", "amount": "209.85" },
    "shopper":  { "currency": "AUD", "amount": "346.25" }
  },
  "discounts": [
    {
      "title": "Loyalty Reward",
      "description": "5% loyalty discount for registered members",
      "percentage": "5"
    }
  ]
}
```

{% endcode %}

The `price` here is the combined pre-discount price of the items the cart discount applies to (wallet €89.95 + belt ×2 €119.90 = €209.85).

#### Two ways to express a discount amount

`DiscountInfoRequestDto` supports two modes:

**Mode A — Percentage:** provide `percentage` only. `discount` and `beforeDiscount` are not required.

```json
{
  "title": "Loyalty Reward",
  "percentage": "5"
}
```

`percentage` must be a string representing a value greater than 0 and less than 100 (e.g. `"5"`, `"20"`, `"7.5"`).

**Mode B — Absolute amounts:** provide `discount` (the amount deducted) and `beforeDiscount` (the price before deduction). Useful when the discount value is fixed rather than percentage-based.

```json
{
  "title": "Loyalty Reward",
  "discount": {
    "retailer": { "currency": "EUR", "amount": "10.50" },
    "shopper":  { "currency": "AUD", "amount": "17.33" }
  },
  "beforeDiscount": {
    "retailer": { "currency": "EUR", "amount": "209.85" },
    "shopper":  { "currency": "AUD", "amount": "346.25" }
  }
}
```

Both modes are valid. Use `percentage` when the rule is rate-based (most promo codes); use `discount`/`beforeDiscount` when the discount is a fixed monetary amount agreed at checkout.
{% endstep %}

{% step %}

### Line Items

Each line item has a product, estimated delivery date, and charges. The scarf line item also carries a product-level discount recorded in `productUnitPriceInfo.discounts`.

#### Line Item 1 — Wallet × 1

The wallet receives a portion of the LOYALTY5 cart discount: 5% × €89.95 = €4.50 / AUD 7.43.

{% code expandable="true" %}

```json
{
  "quantity": 1,
  "lineItemId": 1,
  "fulfilmentCountryIso": "IT",

  "product": {
    "productCode": "SKU-00123",
    "hsCode": "4202.32",
    "title": "Classic Leather Wallet",
    "description": "Slim bifold wallet in full-grain cowhide leather",
    "color": "Tan",
    "size": "One Size",
    "imageUrl": "https://cdn.mybrand.com/images/sku-00123.jpg",
    "category": "ApparelAccessories",
    "isReturnProhibited": false,
    "productUnitPriceInfo": {
      "price": {
        "retailer": { "currency": "EUR", "amount": "89.95" },
        "shopper":  { "currency": "AUD", "amount": "148.42" }
      }
    }
  },

  "estimatedDeliveryDate": {
    "fromEShopWorldRangeFrom": "2024-11-18T00:00:00Z",
    "fromEShopWorldRangeTo":   "2024-11-20T00:00:00Z"
  },

  "charges": {
    "subTotal": {
      "retailer": { "currency": "EUR", "amount": "96.13" },
      "shopper":  { "currency": "AUD", "amount": "158.61" }
    },
    "subTotalBeforeTaxesAndCartDiscountsApplied": {
      "retailer": { "currency": "EUR", "amount": "89.95" },
      "shopper":  { "currency": "AUD", "amount": "148.42" }
    },
    "subTotalAfterCartDiscount": {
      "retailer": { "currency": "EUR", "amount": "85.45" },
      "shopper":  { "currency": "AUD", "amount": "140.99" }
    },
    "cartDiscountAttribution": {
      "retailer": { "currency": "EUR", "amount": "4.50" },
      "shopper":  { "currency": "AUD", "amount": "7.43" }
    },
    "duty": {
      "retailer": { "currency": "EUR", "amount": "10.68" },
      "shopper":  { "currency": "AUD", "amount": "17.62" }
    }
  }
}
```

{% endcode %}

{% hint style="info" %}
Note `fulfilmentCountryIso: "IT"` — the wallet is fulfilled from Italy. This field is optional but useful when products ship from different origins within the same order.
{% endhint %}

#### Line Item 2 — Belt × 2

The belt receives the remaining LOYALTY5 cart discount: 5% × €119.90 = €6.00 / AUD 9.90. Note that `subTotal` covers both units of the belt (quantity × per-unit values).

{% code expandable="true" %}

```json
{
  "quantity": 2,
  "lineItemId": 2,
  "fulfilmentCountryIso": "IT",

  "product": {
    "productCode": "SKU-00456",
    "hsCode": "4203.30",
    "title": "Leather Belt",
    "description": "Full-grain leather dress belt with silver buckle",
    "color": "Brown",
    "size": "90cm",
    "imageUrl": "https://cdn.mybrand.com/images/sku-00456.jpg",
    "category": "ApparelAccessories",
    "isReturnProhibited": false,
    "productUnitPriceInfo": {
      "price": {
        "retailer": { "currency": "EUR", "amount": "59.95" },
        "shopper":  { "currency": "AUD", "amount": "98.92" }
      }
    }
  },

  "estimatedDeliveryDate": {
    "fromEShopWorldRangeFrom": "2024-11-18T00:00:00Z",
    "fromEShopWorldRangeTo":   "2024-11-20T00:00:00Z"
  },

  "charges": {
    "subTotal": {
      "retailer": { "currency": "EUR", "amount": "123.01" },
      "shopper":  { "currency": "AUD", "amount": "202.97" }
    },
    "subTotalBeforeTaxesAndCartDiscountsApplied": {
      "retailer": { "currency": "EUR", "amount": "119.90" },
      "shopper":  { "currency": "AUD", "amount": "197.84" }
    },
    "subTotalAfterCartDiscount": {
      "retailer": { "currency": "EUR", "amount": "113.90" },
      "shopper":  { "currency": "AUD", "amount": "187.94" }
    },
    "cartDiscountAttribution": {
      "retailer": { "currency": "EUR", "amount": "6.00" },
      "shopper":  { "currency": "AUD", "amount": "9.90" }
    },
    "duty": {
      "retailer": { "currency": "EUR", "amount": "9.11" },
      "shopper":  { "currency": "AUD", "amount": "15.03" }
    }
  }
}
```

{% endcode %}

#### Line Item 3 — Scarf × 1 (with product-level discount)

The scarf has WINTER20 applied — a 20% product-level discount. This is recorded in `productUnitPriceInfo.discounts` so ESW has a full audit trail of what the original price was and how much was discounted.

The scarf does **not** receive any of the LOYALTY5 cart discount (it was excluded from that promotion), so `cartDiscountAttribution` is omitted.

{% code expandable="true" %}

```json
{
  "quantity": 1,
  "lineItemId": 3,
  "fulfilmentCountryIso": "FR",

  "product": {
    "productCode": "SKU-00789",
    "hsCode": "6214.10",
    "title": "Silk Scarf",
    "description": "100% pure silk scarf with hand-rolled edges",
    "color": "Ivory",
    "size": "90 × 90cm",
    "imageUrl": "https://cdn.mybrand.com/images/sku-00789.jpg",
    "category": "ApparelAccessories",
    "isReturnProhibited": false,
    "productUnitPriceInfo": {
      "price": {
        "retailer": { "currency": "EUR", "amount": "149.00" },
        "shopper":  { "currency": "AUD", "amount": "245.85" }
      },
      "discounts": [
        {
          "title": "Winter Sale",
          "description": "20% off selected scarves — code WINTER20",
          "percentage": "20"
        }
      ]
    }
  },

  "estimatedDeliveryDate": {
    "fromEShopWorldRangeFrom": "2024-11-18T00:00:00Z",
    "fromEShopWorldRangeTo":   "2024-11-20T00:00:00Z"
  },

  "charges": {
    "subTotal": {
      "retailer": { "currency": "EUR", "amount": "123.97" },
      "shopper":  { "currency": "AUD", "amount": "204.55" }
    },
    "subTotalBeforeTaxesAndCartDiscountsApplied": {
      "retailer": { "currency": "EUR", "amount": "119.20" },
      "shopper":  { "currency": "AUD", "amount": "196.68" }
    },
    "duty": {
      "retailer": { "currency": "EUR", "amount": "4.77" },
      "shopper":  { "currency": "AUD", "amount": "7.87" }
    }
  }
}
```

{% endcode %}
{% endstep %}

{% step %}

### Retailer Delivery Option

`retailerDeliveryOption` has four required fields: `deliveryOption`, `title`, `estimatedDeliveryDateToShopper`, and `deliveryOptionPriceInfo`.

{% code expandable="true" %}

```json
"retailerDeliveryOption": {
  "deliveryOption": "EXPRESS_AU",
  "title": "Express Courier (2–4 business days)",
  "estimatedDeliveryDateToShopper": {
    "dateFrom": "2024-11-18T00:00:00Z",
    "dateTo":   "2024-11-20T00:00:00Z"
  },
  "deliveryOptionPriceInfo": {
    "price": {
      "retailer": { "currency": "EUR", "amount": "18.00" },
      "shopper":  { "currency": "AUD", "amount": "29.70" }
    }
  },
  "metadataItems": [
    {
      "name": "carrier",
      "value": "DHL Express"
    },
    {
      "name": "trackingServiceCode",
      "value": "EXPRESS_AU_TRACK"
    }
  ]
}
```

{% endcode %}

#### `retailerDeliveryOption` vs `deliveryOption`

| Field                    | When to use                                                                                                                   |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------- |
| `deliveryOption`         | ESW-configured delivery option — code and pricing are owned by ESW. Max 15 chars on the code.                                 |
| `retailerDeliveryOption` | Retailer-configured delivery option — code, title, date, and price are provided by the retailer. No length limit on the code. |

Only one of the two should be populated for a given order. If the retailer is overriding ESW's delivery pricing, set `deliveryOption.isPriceOverrideFromRetailer: true` instead of using `retailerDeliveryOption`.

#### `estimatedDeliveryDateToShopper` fields

| Field      | Required | Description                                                      |
| ---------- | -------- | ---------------------------------------------------------------- |
| `dateTo`   | ✅        | Latest estimated delivery date — the outer bound of the window   |
| `dateFrom` | ❌        | Earliest estimated delivery date — the inner bound of the window |

`dateTo` is the only required field. Always include `dateFrom` when a range is known — it gives the shopper a more informative delivery window.

#### `metadataItems`

`metadataItems` is an optional array of key-value pairs available on most objects in the request. Use it to pass additional context agreed with ESW — carrier codes, tracking service identifiers, warehouse codes, etc.

| Field   | Required | Max length | Description |
| ------- | -------- | ---------- | ----------- |
| `name`  | ✅        | 64 chars   | The key     |
| `value` | ❌        | 1000 chars | The value   |

> **Important:** use of `metadataItems` must be agreed with ESW in advance. Do not pass arbitrary keys — only keys that ESW has confirmed are expected and will be processed.
> {% endstep %}

{% step %}

### Multiple Payment Records

This order was paid with two methods: AUD 100.00 in store credit applied first, then AUD 499.96 on Visa.

The `paymentDetails` field captures the **primary** payment. The `paymentRecords` array captures **all** payments including the primary, making it the complete record of how the order was paid.

{% code expandable="true" %}

```json
"paymentDetails": {
  "method": "StoreCredit",
  "time": "2024-11-15T09:14:22Z",
  "fraudHold": false,
  "amountPaid": 100.00,
  "isOverCounter": false
},

"paymentRecords": [
  {
    "method": "StoreCredit",
    "time": "2024-11-15T09:14:22Z",
    "fraudHold": false,
    "amountPaid": 100.00,
    "isOverCounter": false
  },
  {
    "method": "Visa",
    "methodCardBrand": "Visa",
    "time": "2024-11-15T09:14:35Z",
    "fraudHold": false,
    "amountPaid": 499.96,
    "isOverCounter": false
  }
]
```

{% endcode %}

<details>

<summary>Payment fields reference</summary>

| Field             | Required | Type                  | Description                                                                                                       |
| ----------------- | -------- | --------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `method`          | ✅        | string                | Payment method name as agreed with ESW — e.g. `"Visa"`, `"Mastercard"`, `"PayPal"`, `"StoreCredit"`, `"GiftCard"` |
| `time`            | ✅        | ISO 8601 UTC datetime | Date and time of pre-authorisation                                                                                |
| `methodCardBrand` | ❌        | string                | Card brand — typically same as `method` for card payments                                                         |
| `fraudHold`       | ❌        | boolean               | `true` if payment is held pending fraud review                                                                    |
| `amountPaid`      | ❌        | number (double)       | Amount paid by this method — note this is a **number** type, not a string                                         |
| `isOverCounter`   | ❌        | boolean               | `true` for deferred payment methods where the shopper pays later in person                                        |
| `ticketDetails`   | ❌        | object                | Voucher or ticket details for over-counter or ticket-based payments                                               |

</details>

#### `paymentDetails` vs `paymentRecords`

| Field            | Contains                 | When to use                                                                                                    |
| ---------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------- |
| `paymentDetails` | Single payment object    | Always required — represents the primary or first payment method                                               |
| `paymentRecords` | Array of payment objects | Include when more than one payment method was used — contains the full payment breakdown including the primary |

When only one payment method was used, `paymentRecords` is typically omitted and `paymentDetails` alone is sufficient. When multiple methods are used, include all of them in `paymentRecords` and set `paymentDetails` to the first/primary method.

#### `ticketDetails` — for over-counter payments

For payment methods like convenience store payments (Japan, Mexico) or bank transfer vouchers where the shopper receives a ticket to pay at a physical location:

```json
"ticketDetails": {
  "number": "TKT-20241115-44821",
  "imageUrl": "https://payments.example.com/tickets/44821.png",
  "expirationDate": "2024-11-17",
  "collectionInstitutionNumber": "12345"
}
```

| Field                         | Description                                                      |
| ----------------------------- | ---------------------------------------------------------------- |
| `number`                      | The ticket or voucher reference number                           |
| `imageUrl`                    | URL of the barcode or QR code image for the payment ticket       |
| `expirationDate`              | Date by which the shopper must complete the over-counter payment |
| `collectionInstitutionNumber` | Institution or store chain identifier                            |
| {% endstep %}                 |                                                                  |

{% step %}

### Contact Details

The shopper has a delivery address in Sydney and a billing address in Melbourne. Both are included as separate entries in the `contactDetails` array, distinguished by `contactDetailType`.

{% code expandable="true" %}

```json
"contactDetails": [
  {
    "contactDetailType": "IsDelivery",
    "firstName": "Sophie",
    "lastName": "Nguyen",
    "address1": "42 George Street",
    "city": "Sydney",
    "region": "NSW",
    "postalCode": "2000",
    "country": "AU",
    "email": "sophie.nguyen@example.com",
    "telephone": "+61412345678",
    "isSelected": true,
    "isDefault": true,
    "saveToProfile": true,
    "status": "Added"
  },
  {
    "contactDetailType": "IsPayment",
    "firstName": "Sophie",
    "lastName": "Nguyen",
    "address1": "18 Collins Street",
    "address2": "Level 4",
    "city": "Melbourne",
    "region": "VIC",
    "postalCode": "3000",
    "country": "AU",
    "email": "sophie.nguyen@example.com",
    "telephone": "+61412345678",
    "isSelected": true,
    "isDefault": false,
    "saveToProfile": false,
    "status": "Added"
  }
]
```

{% endcode %}

#### `contactDetailType` values

| Value          | Description                                                      |
| -------------- | ---------------------------------------------------------------- |
| `"IsDelivery"` | Shipping address — where the order will be physically delivered  |
| `"IsPayment"`  | Billing address — the address associated with the payment method |

When delivery and billing addresses are the same, a single `IsDelivery` entry is sufficient. When they differ, include both. The array is processed first-to-last.

<details>

<summary>Address field reference</summary>

| Field                    | Required | Max length                   | Description                                                                                                |
| ------------------------ | -------- | ---------------------------- | ---------------------------------------------------------------------------------------------------------- |
| `contactDetailType`      | ✅        | —                            | `"IsDelivery"` or `"IsPayment"`                                                                            |
| `country`                | ✅        | 2 chars (ISO 3166-1 alpha-2) | Country code of the address                                                                                |
| `firstName`              | ❌        | 70 chars                     | Recipient first name                                                                                       |
| `lastName`               | ❌        | 70 chars                     | Recipient last name                                                                                        |
| `address1`               | ❌        | 150 chars                    | Primary address line                                                                                       |
| `address2`               | ❌        | 150 chars                    | Secondary address line                                                                                     |
| `address3`               | ❌        | 150 chars                    | Tertiary address line                                                                                      |
| `city`                   | ❌        | 150 chars                    | City or suburb                                                                                             |
| `region`                 | ❌        | 150 chars                    | State, province, or county — ISO code preferred where available                                            |
| `postalCode`             | ❌        | 50 chars                     | Postal or ZIP code                                                                                         |
| `poBox`                  | ❌        | 50 chars                     | PO box number                                                                                              |
| `email`                  | ❌        | 128 chars                    | Email address                                                                                              |
| `telephone`              | ❌        | 150 chars                    | Phone number (include country code)                                                                        |
| `gender`                 | ❌        | —                            | `"None"`, `"Male"`, `"Female"`, or `"Unisex"`                                                              |
| `nativeFirstName`        | ❌        | —                            | First name in native script (e.g. Katakana for Japanese shoppers)                                          |
| `nativeLastName`         | ❌        | —                            | Last name in native script                                                                                 |
| `contactDetailsNickName` | ❌        | —                            | Label for the address (e.g. `"Home"`, `"Work"`)                                                            |
| `addressId`              | ❌        | —                            | ID from the shopper's saved address book                                                                   |
| `isSelected`             | ❌        | boolean                      | The address selected for this order                                                                        |
| `isDefault`              | ❌        | boolean                      | Whether this address should be stored as the shopper's default                                             |
| `saveToProfile`          | ❌        | boolean                      | Whether to save this address to the shopper's profile                                                      |
| `status`                 | ❌        | —                            | `"Unedited"` (from saved profile, unchanged), `"Added"` (new address), `"Edited"` (modified saved address) |

</details>
{% endstep %}

{% step %}

### Shopper Checkout Experience

Captures the shopper's language, marketing preferences, and gift packaging selection.

{% code expandable="true" %}

```json
"shopperCheckoutExperience": {
  "shopperCultureLanguageIso": "en-AU",
  "registeredProfileId": "PROFILE-55291",
  "emailMarketingOptIn": true,
  "smsMarketingOptIn": false,
  "phoneMarketingOptIn": false,
  "postMarketingOptIn": false,
  "saveAddressForNextPurchase": true,
  "notes": "Please leave with concierge if no one home",
  "packagingOption": {
    "packagingType": "GiftBox",
    "message": "Happy Birthday! With love, Mum x"
  },
  "metadataItems": [
    {
      "name": "loyaltyTier",
      "value": "Gold"
    }
  ]
}
```

{% endcode %}

#### `shopperCultureLanguageIso`

The only required field in this object. Format is ISO 639-1 language code + ISO 3166-1 country code, hyphen-separated:

```ruby
"en-AU"   English (Australia)
"en-US"   English (United States)
"fr-FR"   French (France)
"de-DE"   German (Germany)
"ja-JP"   Japanese (Japan)
"zh-CN"   Chinese Simplified (China)
```

#### `packagingOption`

All three fields are optional but if the shopper selected a gift packaging option, include all relevant ones:

| Field           | Description                                                                               |
| --------------- | ----------------------------------------------------------------------------------------- |
| `packagingType` | The packaging type code as agreed with ESW — e.g. `"GiftBox"`, `"GiftBag"`, `"Standard"`  |
| `imageUrl`      | URL of an image representing the packaging (shown in order confirmation UI)               |
| `message`       | The gift message entered by the shopper — max length not specified but keep it reasonable |
| {% endstep %}   |                                                                                           |

{% step %}

### Order-Level Charges

With all line item charges defined, the order-level charges bring everything together.

**Cart discount reconciliation:**

```
wallet cartDiscountAttribution:   €4.50
belt   cartDiscountAttribution: + €6.00
                                ──────
totalCartDiscount:                €10.50  ✅
```

**Line item subtotals:**

```
wallet subTotal:  €96.13   AUD 158.61
belt   subTotal: €123.01   AUD 202.97
scarf  subTotal: €123.97   AUD 204.55
               ──────────  ───────────
sum:            €343.11    AUD 566.13
```

**Add order-level delivery and administration:**

```
€343.11 + €18.00 + €2.50 = €363.61  ✅ matches checkoutTotal
AUD 566.13 + AUD 29.70 + AUD 4.13 = AUD 599.96  ✅ matches checkoutTotal
```

{% code expandable="true" %}

```json
"charges": {
  "total": {
    "retailer": { "currency": "EUR", "amount": "363.61" },
    "shopper":  { "currency": "AUD", "amount": "599.96" }
  },
  "totalBeforeTaxesAndCartDiscountsApplied": {
    "retailer": { "currency": "EUR", "amount": "329.05" },
    "shopper":  { "currency": "AUD", "amount": "542.93" }
  },
  "totalAfterCartDiscount": {
    "retailer": { "currency": "EUR", "amount": "318.55" },
    "shopper":  { "currency": "AUD", "amount": "525.61" }
  },
  "totalCartDiscount": {
    "retailer": { "currency": "EUR", "amount": "10.50" },
    "shopper":  { "currency": "AUD", "amount": "17.33" }
  },
  "duty": {
    "retailer": { "currency": "EUR", "amount": "24.56" },
    "shopper":  { "currency": "AUD", "amount": "40.52" }
  },
  "delivery": {
    "retailer": { "currency": "EUR", "amount": "18.00" },
    "shopper":  { "currency": "AUD", "amount": "29.70" }
  },
  "administration": {
    "retailer": { "currency": "EUR", "amount": "2.50" },
    "shopper":  { "currency": "AUD", "amount": "4.13" }
  }
}
```

{% endcode %}
{% endstep %}

{% step %}

### Complete Request

{% code expandable="true" %}

```json
{
  "retailerCartId": "CART-2024-91037",
  "eShopWorldOrderNumber": "ESW-20241115-00091037",
  "deliveryCountryIso": "AU",
  "cartType": "Standard",
  "pricingSynchronizationId": "psync-def789ghi012",

  "checkoutTotal": {
    "retailer": { "currency": "EUR", "amount": "363.61" },
    "shopper":  { "currency": "AUD", "amount": "599.96" }
  },

  "retailerPromoCodes": [
    {
      "promoCode": "WINTER20",
      "title": "Winter Sale",
      "description": "20% off selected scarves and shawls"
    },
    {
      "promoCode": "LOYALTY5",
      "title": "Loyalty Reward",
      "description": "5% loyalty discount for registered members"
    }
  ],

  "cartDiscountPriceInfo": {
    "price": {
      "retailer": { "currency": "EUR", "amount": "209.85" },
      "shopper":  { "currency": "AUD", "amount": "346.25" }
    },
    "discounts": [
      {
        "title": "Loyalty Reward",
        "description": "5% loyalty discount for registered members",
        "percentage": "5"
      }
    ]
  },

  "paymentDetails": {
    "method": "StoreCredit",
    "time": "2024-11-15T09:14:22Z",
    "fraudHold": false,
    "amountPaid": 100.00,
    "isOverCounter": false
  },

  "paymentRecords": [
    {
      "method": "StoreCredit",
      "time": "2024-11-15T09:14:22Z",
      "fraudHold": false,
      "amountPaid": 100.00,
      "isOverCounter": false
    },
    {
      "method": "Visa",
      "methodCardBrand": "Visa",
      "time": "2024-11-15T09:14:35Z",
      "fraudHold": false,
      "amountPaid": 499.96,
      "isOverCounter": false
    }
  ],

  "lineItems": [
    {
      "quantity": 1,
      "lineItemId": 1,
      "fulfilmentCountryIso": "IT",
      "product": {
        "productCode": "SKU-00123",
        "hsCode": "4202.32",
        "title": "Classic Leather Wallet",
        "description": "Slim bifold wallet in full-grain cowhide leather",
        "color": "Tan",
        "size": "One Size",
        "imageUrl": "https://cdn.mybrand.com/images/sku-00123.jpg",
        "category": "ApparelAccessories",
        "isReturnProhibited": false,
        "productUnitPriceInfo": {
          "price": {
            "retailer": { "currency": "EUR", "amount": "89.95" },
            "shopper":  { "currency": "AUD", "amount": "148.42" }
          }
        }
      },
      "estimatedDeliveryDate": {
        "fromEShopWorldRangeFrom": "2024-11-18T00:00:00Z",
        "fromEShopWorldRangeTo":   "2024-11-20T00:00:00Z"
      },
      "charges": {
        "subTotal": {
          "retailer": { "currency": "EUR", "amount": "96.13" },
          "shopper":  { "currency": "AUD", "amount": "158.61" }
        },
        "subTotalBeforeTaxesAndCartDiscountsApplied": {
          "retailer": { "currency": "EUR", "amount": "89.95" },
          "shopper":  { "currency": "AUD", "amount": "148.42" }
        },
        "subTotalAfterCartDiscount": {
          "retailer": { "currency": "EUR", "amount": "85.45" },
          "shopper":  { "currency": "AUD", "amount": "140.99" }
        },
        "cartDiscountAttribution": {
          "retailer": { "currency": "EUR", "amount": "4.50" },
          "shopper":  { "currency": "AUD", "amount": "7.43" }
        },
        "duty": {
          "retailer": { "currency": "EUR", "amount": "10.68" },
          "shopper":  { "currency": "AUD", "amount": "17.62" }
        }
      }
    },
    {
      "quantity": 2,
      "lineItemId": 2,
      "fulfilmentCountryIso": "IT",
      "product": {
        "productCode": "SKU-00456",
        "hsCode": "4203.30",
        "title": "Leather Belt",
        "description": "Full-grain leather dress belt with silver buckle",
        "color": "Brown",
        "size": "90cm",
        "imageUrl": "https://cdn.mybrand.com/images/sku-00456.jpg",
        "category": "ApparelAccessories",
        "isReturnProhibited": false,
        "productUnitPriceInfo": {
          "price": {
            "retailer": { "currency": "EUR", "amount": "59.95" },
            "shopper":  { "currency": "AUD", "amount": "98.92" }
          }
        }
      },
      "estimatedDeliveryDate": {
        "fromEShopWorldRangeFrom": "2024-11-18T00:00:00Z",
        "fromEShopWorldRangeTo":   "2024-11-20T00:00:00Z"
      },
      "charges": {
        "subTotal": {
          "retailer": { "currency": "EUR", "amount": "123.01" },
          "shopper":  { "currency": "AUD", "amount": "202.97" }
        },
        "subTotalBeforeTaxesAndCartDiscountsApplied": {
          "retailer": { "currency": "EUR", "amount": "119.90" },
          "shopper":  { "currency": "AUD", "amount": "197.84" }
        },
        "subTotalAfterCartDiscount": {
          "retailer": { "currency": "EUR", "amount": "113.90" },
          "shopper":  { "currency": "AUD", "amount": "187.94" }
        },
        "cartDiscountAttribution": {
          "retailer": { "currency": "EUR", "amount": "6.00" },
          "shopper":  { "currency": "AUD", "amount": "9.90" }
        },
        "duty": {
          "retailer": { "currency": "EUR", "amount": "9.11" },
          "shopper":  { "currency": "AUD", "amount": "15.03" }
        }
      }
    },
    {
      "quantity": 1,
      "lineItemId": 3,
      "fulfilmentCountryIso": "FR",
      "product": {
        "productCode": "SKU-00789",
        "hsCode": "6214.10",
        "title": "Silk Scarf",
        "description": "100% pure silk scarf with hand-rolled edges",
        "color": "Ivory",
        "size": "90 × 90cm",
        "imageUrl": "https://cdn.mybrand.com/images/sku-00789.jpg",
        "category": "ApparelAccessories",
        "isReturnProhibited": false,
        "productUnitPriceInfo": {
          "price": {
            "retailer": { "currency": "EUR", "amount": "149.00" },
            "shopper":  { "currency": "AUD", "amount": "245.85" }
          },
          "discounts": [
            {
              "title": "Winter Sale",
              "description": "20% off selected scarves — code WINTER20",
              "percentage": "20"
            }
          ]
        }
      },
      "estimatedDeliveryDate": {
        "fromEShopWorldRangeFrom": "2024-11-18T00:00:00Z",
        "fromEShopWorldRangeTo":   "2024-11-20T00:00:00Z"
      },
      "charges": {
        "subTotal": {
          "retailer": { "currency": "EUR", "amount": "123.97" },
          "shopper":  { "currency": "AUD", "amount": "204.55" }
        },
        "subTotalBeforeTaxesAndCartDiscountsApplied": {
          "retailer": { "currency": "EUR", "amount": "119.20" },
          "shopper":  { "currency": "AUD", "amount": "196.68" }
        },
        "duty": {
          "retailer": { "currency": "EUR", "amount": "4.77" },
          "shopper":  { "currency": "AUD", "amount": "7.87" }
        }
      }
    }
  ],

  "charges": {
    "total": {
      "retailer": { "currency": "EUR", "amount": "363.61" },
      "shopper":  { "currency": "AUD", "amount": "599.96" }
    },
    "totalBeforeTaxesAndCartDiscountsApplied": {
      "retailer": { "currency": "EUR", "amount": "329.05" },
      "shopper":  { "currency": "AUD", "amount": "542.93" }
    },
    "totalAfterCartDiscount": {
      "retailer": { "currency": "EUR", "amount": "318.55" },
      "shopper":  { "currency": "AUD", "amount": "525.61" }
    },
    "totalCartDiscount": {
      "retailer": { "currency": "EUR", "amount": "10.50" },
      "shopper":  { "currency": "AUD", "amount": "17.33" }
    },
    "duty": {
      "retailer": { "currency": "EUR", "amount": "24.56" },
      "shopper":  { "currency": "AUD", "amount": "40.52" }
    },
    "delivery": {
      "retailer": { "currency": "EUR", "amount": "18.00" },
      "shopper":  { "currency": "AUD", "amount": "29.70" }
    },
    "administration": {
      "retailer": { "currency": "EUR", "amount": "2.50" },
      "shopper":  { "currency": "AUD", "amount": "4.13" }
    }
  },

  "contactDetails": [
    {
      "contactDetailType": "IsDelivery",
      "firstName": "Sophie",
      "lastName": "Nguyen",
      "address1": "42 George Street",
      "city": "Sydney",
      "region": "NSW",
      "postalCode": "2000",
      "country": "AU",
      "email": "sophie.nguyen@example.com",
      "telephone": "+61412345678",
      "isSelected": true,
      "isDefault": true,
      "saveToProfile": true,
      "status": "Added"
    },
    {
      "contactDetailType": "IsPayment",
      "firstName": "Sophie",
      "lastName": "Nguyen",
      "address1": "18 Collins Street",
      "address2": "Level 4",
      "city": "Melbourne",
      "region": "VIC",
      "postalCode": "3000",
      "country": "AU",
      "email": "sophie.nguyen@example.com",
      "telephone": "+61412345678",
      "isSelected": true,
      "isDefault": false,
      "saveToProfile": false,
      "status": "Added"
    }
  ],

  "retailerDeliveryOption": {
    "deliveryOption": "EXPRESS_AU",
    "title": "Express Courier (2–4 business days)",
    "estimatedDeliveryDateToShopper": {
      "dateFrom": "2024-11-18T00:00:00Z",
      "dateTo":   "2024-11-20T00:00:00Z"
    },
    "deliveryOptionPriceInfo": {
      "price": {
        "retailer": { "currency": "EUR", "amount": "18.00" },
        "shopper":  { "currency": "AUD", "amount": "29.70" }
      }
    },
    "metadataItems": [
      { "name": "carrier", "value": "DHL Express" },
      { "name": "trackingServiceCode", "value": "EXPRESS_AU_TRACK" }
    ]
  },

  "shopperCheckoutExperience": {
    "shopperCultureLanguageIso": "en-AU",
    "registeredProfileId": "PROFILE-55291",
    "emailMarketingOptIn": true,
    "smsMarketingOptIn": false,
    "phoneMarketingOptIn": false,
    "postMarketingOptIn": false,
    "saveAddressForNextPurchase": true,
    "notes": "Please leave with concierge if no one home",
    "packagingOption": {
      "packagingType": "GiftBox",
      "message": "Happy Birthday! With love, Mum x"
    },
    "metadataItems": [
      { "name": "loyaltyTier", "value": "Gold" }
    ]
  },

  "retailerCheckoutExperience": {
    "metadataItems": [
      { "name": "orderSource", "value": "MobileApp" },
      { "name": "appVersion", "value": "4.2.1" }
    ]
  }
}
```

{% endcode %}
{% endstep %}

{% step %}

### Full Reconciliation Check

Before submitting, verify these relationships hold:

#### Checkout total = `charges.total`

```
checkoutTotal.retailer.amount  ==  charges.total.retailer.amount
"363.61"                       ==  "363.61"  ✅

checkoutTotal.shopper.amount   ==  charges.total.shopper.amount
"599.96"                       ==  "599.96"  ✅
```

#### Line item subtotals + order-level charges = `charges.total`

```
lineItems[0].charges.subTotal  €96.13   AUD 158.61
lineItems[1].charges.subTotal €123.01   AUD 202.97
lineItems[2].charges.subTotal €123.97   AUD 204.55
                              ───────   ──────────
sum of line items:            €343.11   AUD 566.13

+ charges.delivery:           + €18.00  + AUD 29.70
+ charges.administration:     +  €2.50  +  AUD 4.13
                              ───────   ──────────
charges.total:                €363.61   AUD 599.96  ✅
```

#### Cart discount attribution = `charges.totalCartDiscount`

```
lineItems[0].charges.cartDiscountAttribution  €4.50   AUD 7.43
lineItems[1].charges.cartDiscountAttribution  €6.00   AUD 9.90
lineItems[2].charges.cartDiscountAttribution  €0.00   AUD 0.00  (not present)
                                             ──────   ─────────
sum:                                         €10.50   AUD 17.33

charges.totalCartDiscount:                   €10.50   AUD 17.33  ✅
```

#### Payment records = `checkoutTotal`

```
StoreCredit amountPaid:  AUD 100.00
Visa        amountPaid:  AUD 499.96
                        ──────────
total paid:              AUD 599.96  ==  checkoutTotal.shopper.amount  ✅
```

{% endstep %}
{% endstepper %}

***

### Pre-Submission Checklist — Complex Order

* [ ] `retailerPromoCodes` array lists every code the shopper entered, in application order
* [ ] `cartDiscountPriceInfo.price` reflects the pre-discount price of the items the cart discount applies to
* [ ] Sum of `lineItems[].charges.cartDiscountAttribution` equals `charges.totalCartDiscount`
* [ ] Product-level discounts are recorded in `productUnitPriceInfo.discounts` on the relevant line item
* [ ] `retailerDeliveryOption` has all four required fields: `deliveryOption`, `title`, `estimatedDeliveryDateToShopper` (with `dateTo`), and `deliveryOptionPriceInfo`
* [ ] `paymentDetails` contains the primary payment method
* [ ] `paymentRecords` contains all payment methods including the primary, and their `amountPaid` values sum to `checkoutTotal.shopper.amount`
* [ ] `contactDetails` has an `IsDelivery` entry; an `IsPayment` entry is included only when the billing address differs from delivery
* [ ] All `metadataItems` keys have been agreed with ESW in advance
* [ ] All standard checklist items from Tutorial 13 apply — amounts as strings, currency codes uppercase, both `retailer` and `shopper` sides present on all `AmountRequestDto` fields


---

# 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://developer.esw.com/checkout-api/resources/tutorials/complex-order-confirmation.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.
