Skip to main content
PATCH
/
order-draft
/
{orderDraftId}
Update and validate an order draft
curl --request PATCH \
  --url https://api.example.com/order-draft/{orderDraftId} \
  --header 'Content-Type: application/json' \
  --data '
{
  "customerFirstName": "John",
  "customerLastName": "Doe",
  "customerLanguage": "fr",
  "customerNote": "For all dishes, put the sauce on the side",
  "deliveryInstructions": "Ring doorbell twice",
  "deliveryAddress": {
    "address": "123 Main St",
    "city": "Anytown",
    "postalCode": "12345",
    "country": "US"
  },
  "deliveryAddressString": "123 Main St, Anytown, 12345, US",
  "deliveryAddressCoordinates": {
    "latitude": 40.7128,
    "longitude": -74.006
  },
  "requestedTime": "2021-01-01T00:00:00+01:00",
  "serviceType": "collection",
  "items": [
    {
      "skuInternalId": "sku-123",
      "quantity": 1,
      "options": [
        {
          "optionInternalId": "opt-123",
          "quantity": 1
        }
      ]
    }
  ],
  "paymentMethod": "TemporaryCard",
  "locationId": "123",
  "codes": [
    "CODE123",
    "CODE456"
  ],
  "deals": [
    {
      "dealInternalId": "deal_combo_123",
      "skus": [
        {
          "skuInternalId": "sku_burger_123",
          "quantity": 1
        },
        {
          "skuInternalId": "sku_fries_456",
          "quantity": 1
        },
        {
          "skuInternalId": "sku_drink_789",
          "quantity": 1
        }
      ]
    }
  ]
}
'
{
  "orderDraft": {
    "id": "ordrft-123",
    "createdAt": "2021-01-01T00:00:00+01:00",
    "conversationId": "123",
    "updatedAt": "2021-01-01T00:00:00+01:00",
    "customerFirstName": "John",
    "customerLastName": "Doe",
    "mode": "location",
    "locationId": "loc-123",
    "customerNote": "This is a note",
    "deliveryAddress": {
      "address": "123 Main St, Anytown, USA",
      "city": "Anytown",
      "country": "USA",
      "postalCode": "12345",
      "state": "CA"
    },
    "deliveryTime": "2021-01-01T00:00:00+01:00",
    "readyTime": "2021-01-01T00:00:00+01:00",
    "serviceType": "delivery",
    "startTime": "2021-01-01T00:00:00+01:00",
    "discounts": [
      {
        "id": "disc_123",
        "type": "fixed",
        "name": "Summer Sale",
        "discountId": "discountId_123",
        "priceOff": {
          "amount": 1000,
          "currency": "CHF"
        }
      },
      {
        "id": "disc_456",
        "type": "percentage",
        "name": "10% Off",
        "discountId": "discountId_456",
        "percentage": 10,
        "priceOff": {
          "amount": 500,
          "currency": "CHF"
        },
        "appliedToTotal": {
          "amount": 5000,
          "currency": "CHF"
        }
      }
    ],
    "items": [
      {
        "id": "item_123",
        "skuInternalId": "sku_internal_123",
        "quantity": 1,
        "options": [
          {
            "id": "opt_123",
            "optionInternalId": "opt_internal_123",
            "quantity": 1
          }
        ]
      }
    ]
  },
  "validation": {
    "type": "validationError",
    "errors": [
      "SERVICE_TYPE_REQUIRED",
      "DELIVERY_ADDRESS_REQUIRED"
    ],
    "validationData": {
      "availablePaymentMethods": [
        "HandledByStore"
      ]
    }
  }
}

Path Parameters

orderDraftId
string
required

ID of the order draft to update

Body

application/json
customerFirstName
string

The customer first name

Example:

"John"

customerLastName
string

The customer last name

Example:

"Doe"

customerLanguage
string

The customer language

Example:

"fr"

customerNote
string

A note from the customer about their order

Example:

"For all dishes, put the sauce on the side"

deliveryInstructions
string

Special instructions for delivery

Example:

"Ring doorbell twice"

deliveryAddress
object

Soon deprecated, use deliveryAddressString/deliveryAddressCoordinates instead

Example:
{
"address": "123 Main St",
"city": "Anytown",
"postalCode": "12345",
"country": "US"
}
deliveryAddressString
string

The delivery address as a string. Have priority over deliveryAddress coordinates.

Example:

"123 Main St, Anytown, 12345, US"

deliveryAddressCoordinates
object

The delivery address as coordinates.

Example:
{ "latitude": 40.7128, "longitude": -74.006 }
requestedTime
object

The requested time in the timezone of the store or "ASAP" if the customer wants to receive their order as soon as possible.

Example:

"2021-01-01T00:00:00+01:00"

serviceType
string

How the customer wants to receive their order. "collection" is for pick up, "delivery" is for delivery, "eat_in" is for eating in the store.

Example:

"collection"

items
string[]

The items and options in the order identified by their internal ID

Example:
[
{
"skuInternalId": "sku-123",
"quantity": 1,
"options": [
{
"optionInternalId": "opt-123",
"quantity": 1
}
]
}
]
paymentMethod
string

The payment method for the order

Example:

"TemporaryCard"

locationId
string

The location ID of the order draft

Example:

"123"

codes
string[]

The codes for the order. These will be applied to the order.

Example:
["CODE123", "CODE456"]
deals
object[]

The deals/combos to add to the order. Each deal requires selecting one SKU per line.

Example:
[
{
"dealInternalId": "deal_combo_123",
"skus": [
{
"skuInternalId": "sku_burger_123",
"quantity": 1
},
{
"skuInternalId": "sku_fries_456",
"quantity": 1
},
{
"skuInternalId": "sku_drink_789",
"quantity": 1
}
]
}
]

Response

Order draft successfully updated and validated

orderDraft
object
required

The updated order draft data

validation
object
required

The validation result