Order Edits
OrderEdit are containers for financial changes after an Order has been placed.
In case no financial aspect of an order should be changed use Order Update which does not perform a recalculation. An alternative if no deliveries or payments occurred could be to replicate the order as a new cart.
The OrderEdit tutorial shows some examples how edits can be performed.
A maximum number of 100 000 order edits can be created per project. Learn more about this limit.
Representations
OrderEdit
id
- String
The unique ID of the OrderEdit.key
- String - Optional
Unique identifier for this edit.version
- Number
The current version of the OrderEdit.createdAt
- DateTimecreatedBy
- CreatedBy BETA
Present on resources created after 2019-02-01 except for events not tracked.lastModifiedAt
- DateTimelastModifiedBy
- LastModifiedBy BETA
Present on resources updated after 2019-02-01 except for events not tracked.resource
- Reference to an Order
The order to be updated with this edit.stagedActions
- Array of StagedOrderUpdateAction
The actions to apply to the Order. Cannot be updated after the edit has been applied.custom
- CustomFields - Optionalresult
- OrderEditResult
Contains a preview of the changes in case of unapplied edit. For applied edits, it contains the summary of the changes.comment
- String - Optional
This field can be used to add textual information regarding the edit.
OrderEditDraft
key
- String - Optional
Unique identifier for this edit.resource
- Reference to an Order
The order to be updated with this edit.stagedActions
- Array of StagedOrderUpdateAction
The actions to apply toresource
.custom
- CustomFieldsDraft - Optional
The custom fields.comment
- String - Optional
This field can be used to add additional textual information regarding the edit.dryRun
- Boolean - Optional, defaults tofalse
When set totrue
the edit is applied on the Order without persisting it.
StagedOrderUpdateAction
See the detailed list of StagedOrderUpdateActions for all update actions available for an OrderEdit.
Many of the update actions for an OrderEdit are known from the update actions available for a Cart. Below is an overview showing the update actions that an Order Edit and a Cart share, as well as the update actions unique to an Order Edit.
The table furthermore provides an overview of the update actions that can only be done within an Order Edit and not as a direct Order update.
Update Action | Cart | direct Order | OrderEdit |
---|---|---|---|
setKey | ✓ | ||
setCustomerEmail | ✓ | ✓ | ✓ |
setShippingAddress | ✓ | ✓ | ✓ |
setBillingAddress | ✓ | ✓ | ✓ |
setCountry | ✓ | - | ✓ |
recalculate | ✓ | - | - |
setShippingMethod | ✓ | - | ✓ |
setCustomShippingMethod | ✓ | - | ✓ |
addDiscountCode | ✓ | - | ✓ |
removeDiscountCode | ✓ | - | ✓ |
setCustomerId | ✓ | ✓ | ✓ |
setAnonymousId | ✓ | - | - |
setCustomerGroup | ✓ | - | ✓ |
setCustomType | ✓ | ✓ | ✓ |
setCustomField | ✓ | ✓ | ✓ |
addPayment | ✓ | ✓ | ✓ |
removePayment | ✓ | ✓ | ✓ |
setShippingMethodTaxRate | ✓ | - | ✓ |
setShippingMethodTaxAmount | ✓ | - | ✓ |
setCartTotalTax | ✓ | - | - |
setOrderTotalTax | - | - | ✓ |
changeTaxMode | ✓ | - | ✓ |
setLocale | ✓ | ✓ | ✓ |
changeTaxRoundingMode | ✓ | - | ✓ |
setShippingRateInput | ✓ | - | ✓ |
changeTaxCalculationMode | ✓ | - | ✓ |
addShoppingList | ✓ | - | ✓ |
setDeleteDaysAfterLastModification | ✓ | - | - |
addItemShippingAddress | ✓ | ✓ | ✓ |
removeItemShippingAddress | ✓ | ✓ | ✓ |
updateItemShippingAddress | ✓ | ✓ | ✓ |
setShippingAddressAndShippingMethod | - | - | ✓ |
setShippingAddressAndCustomShippingMethod | - | - | ✓ |
LineItem update actions | |||
applyDeltaToLineItemShippingDetailsTargets | ✓ | - | - |
setLineItemShippingDetails | ✓ | ✓ | ✓ |
addLineItem | ✓ | - | ✓ |
removeLineItem | ✓ | - | ✓ |
changeLineItemQuantity | ✓ | - | ✓ |
setLineItemCustomType | ✓ | ✓ | ✓ |
setLineItemCustomField | ✓ | ✓ | ✓ |
setShippingAddressCustomType | ✓ | ✓ | ✓ |
setShippingAddressCustomField | ✓ | ✓ | ✓ |
setBillingAddressCustomType | ✓ | ✓ | ✓ |
setBillingAddressCustomField | ✓ | ✓ | ✓ |
setItemShippingAddressCustomType | ✓ | ✓ | ✓ |
setItemShippingAddressCustomField | ✓ | ✓ | ✓ |
setDeliveryAddressCustomType | ✓ | ✓ | ✓ |
setDeliveryAddressCustomField | ✓ | ✓ | ✓ |
setDeliveryCustomType | - | ✓ | ✓ |
setDeliveryCustomField | - | ✓ | ✓ |
setParcelCustomType | - | ✓ | ✓ |
setParcelCustomField | - | ✓ | ✓ |
setReturnItemCustomType | - | ✓ | ✓ |
setReturnItemCustomField | - | ✓ | ✓ |
setLineItemTaxRate | ✓ | - | ✓ |
setLineItemTaxAmount | ✓ | - | ✓ |
setLineItemTotalPrice | ✓ | - | ✓ |
setLineItemPrice | ✓ | - | ✓ |
setLineItemDistributionChannel | ✓ | - | ✓ |
CustomLineItem update actions | |||
applyDeltaToCustomLineItemShippingDetailsTargets | ✓ | - | - |
setCustomLineItemShippingDetails | ✓ | - | - |
addCustomLineItem | ✓ | - | ✓ |
removeCustomLineItem | ✓ | - | ✓ |
setCustomLineItemCustomType | ✓ | ✓ | ✓ |
setCustomLineItemCustomField | ✓ | ✓ | ✓ |
setCustomLineItemTaxAmount | ✓ | - | ✓ |
setCustomLineItemTaxRate | ✓ | - | ✓ |
changeCustomLineItemQuantity | ✓ | - | ✓ |
changeCustomLineItemMoney | ✓ | - | ✓ |
OrderEditResult
Provides information about the state of the OrderEdit. Four possible states exist:
NotProcessed
PreviewFailure
PreviewSuccess
Applied
OrderEditPreviewSuccess
The result
contains a preview
field in which the order is presented as it would appear if the stagedActions
were to be applied. In a similar fashion, the messagePayloads
field contains the message bodies of the order shown in preview
.
Please note that the result is generated on the fly when an OrderEdit is called. Its data is not persisted but always dynamically pulled by dry running the update actions from stagedActions
on the current order version, not from the order version at the time of the edit creation. Therefore, result
fields cannot be used in query predicates (except for type "NotProcessed"
and "Applied"
).
type
- String -"PreviewSuccess"
preview
- Order (not a reference to Order)
The order preview. The preview also runs Order API Extensions if there are any.messagePayloads
- Array of OrderMessagePayload
The messages which would be emitted if this edit would be applied.
If reference expansion is used on the resource
field, a race condition can occur if the order is updated after the preview is calculated but before resource
is expanded, in which case the preview is based on an older order version.
This rare case can be detected when the messagePayloads
contains an OrderEditAppliedMessage which has in excerptBeforeEdit
a different order version than the expanded order.
OrderEditPreviewFailure
Result if the stagedActions
cannnot be applied to the order.
Like OrderEditPreviewSuccess the data is calculated on the fly and not queryable.
type
- String -"PreviewFailure"
errors
- Array of Error
OrderEditNotProcessed
The edit has not been applied or processed in any way.
The type
field can be queried.
type
- String -"NotProcessed"
OrderEditApplied
Contains information about a successful applied edit.
type
- String -"Applied"
appliedAt
- DateTime the time stamp when the edit was applied.excerptBeforeEdit
- OrderExcerpt
The summary of the order before the edit was applied.excerptAfterEdit
- OrderExcerpt
The summary of the order after the edit was applied.
OrderExcerpt
A summary about the order concerning total price and version.
totalPrice
- CentPrecisionMoneytaxedPrice
- TaxedPrice - Optionalversion
- the version of the Order.
OrderMessagePayload
It is an OrderMessage without the common Message envelope fields, but still contains the payload and the type of the message.
type
- String
The type of the message.
Get OrderEdit
Get OrderEdit by ID
Endpoint: /{projectKey}/orders/edits/{id}
Method: GET
OAuth 2.0 Scopes: view_order_edits:{projectKey}
Response Representation: OrderEdit
Get OrderEdit by Key
Endpoint: /{projectKey}/orders/edits/key={key}
Method: GET
OAuth 2.0 Scopes: view_order_edits:{projectKey}
Response Representation: OrderEdit
Query OrderEdits
Endpoint: /{projectKey}/orders/edits
Method: GET
OAuth 2.0 Scopes: view_order_edits:{projectKey}
Response Representation: PagedQueryResult with results
containing an array of OrderEdit
calculates Order Preview: false
Query Parameters:
where
- Query Predicate - Optionalsort
- Sort - Optionalexpand
- Expansion - Optionallimit
- Number - Optionaloffset
- Number - Optional
Create an OrderEdit
Endpoint: /{projectKey}/orders/edits
Method: POST
OAuth 2.0 Scopes: manage_order_edits:{projectKey}
Request Representation: OrderEditDraft
Response Representation: OrderEdit
calculates Order Preview: true
It is possible to create multiple OrderEdits for one order and apply then in sequence to the Order. It is, however, also possible to create multiple OrderEdits in parallel as alternatives to each other and have only one of them be applied to the Order.
Please note that the OrderEdit feature in its initial release does not support the tracking or reserving of inventory. An OrderEdit can therefore only be created if the InventoryMode of the order is "None"
.
Update OrderEdit
Update OrderEdit by ID
Endpoint: /{projectKey}/orders/edits/{id}
Method: POST
OAuth 2.0 Scopes: manage_order_edits:{projectKey}
Response Representation: OrderEdit
calculates Order Preview: true
Fields:
version
- Number - Required
The expected version of the OrderEdit on which the changes should be applied. If the expected version does not match the actual version, a 409 Conflict will be returned.actions
- Array of UpdateAction - Required
The list of update actions to be performed on the OrderEdit.dryRun
- Boolean - Optional, defaults tofalse
When set totrue
the edit is applied on the Order without persisting it.
Update OrderEdit by Key
Endpoint: /{projectKey}/orders/edits/key={key}
Method: POST
OAuth 2.0 Scopes: manage_order_edits:{projectKey}
Response Representation: OrderEdit
calculates Order Preview: true
Fields:
version
- Number - Required
The expected version of the OrderEdit on which the changes should be applied. If the expected version does not match the actual version, a 409 Conflict will be returned.actions
- Array of UpdateAction - Required
The list of update actions to be performed on the OrderEdit.dryRun
- Boolean - Optional, defaults tofalse
When set totrue
the edit is applied on the Order without persisting it.
Update actions
Set CustomType
This action sets, overwrites, or removes any existing custom type and fields for an existing OrderEdit.
action
- String -"setCustomType"
type
- ResourceIdentifier of a Type - Optional
If set, the custom type is set to this new value.
If absent, the custom type and any existing custom fields are removed.fields
- A valid JSON object, based on the FieldDefinitions of the Type - Optional
If set, the custom fields are set to this new value.
Set CustomField
This action sets, overwrites, or removes any existing custom field for an existing OrderEdit.
action
- String -"setCustomField"
name
- String - Requiredvalue
- Value - Optional
Ifvalue
is absent ornull
, this field will be removed if it exists. Trying to remove a field that does not exist will fail with an InvalidOperation error. Ifvalue
is provided, set thevalue
of the field defined by thename
.
Set Key
action
- String -"setKey"
key
- String - Optional
Ifkey
is absent ornull
, the existing key, if any, will be removed.
Set StagedActions
Replaces the whole stagedActions
array.
For applied edits the stagedActions
cannot be changed.
action
- String -"setStagedActions"
stagedActions
- Array of StagedOrderUpdateAction
The actions to edit theresource
.
Add StagedAction
Appends a StagedOrderUpdateAction to the end of the stagedActions
array.
For applied edits the stagedActions
cannot be changed.
action
- String -"addStagedAction"
stagedAction
- StagedOrderUpdateAction
Set Comment
Sets or unsets the comment.
action
- String -"setComment"
comment
- String - Optional
Apply an OrderEdit
Endpoint: /{projectKey}/orders/edits/{id}/apply
Method: POST
OAuth 2.0 Scopes: manage_order_edits:{projectKey}
Response Representation: OrderEdit
Fields:
editVersion
- Number - Required
The version of the edit to be applied.resourceVersion
- Number - Required
The current version of the order to which the edit should be applied.
If one or both versions do not match the actual version, then a 409 Conflict response is returned.
When and OrderEdit has been applied, stagedActions
can no longer be updated.
An applied edit creates the order message OrderEditAppliedMessage if messages are enabled for the project.
Delete OrderEdit by ID
Endpoint: /{projectKey}/orders/edits/{id}
Method: DELETE
OAuth 2.0 Scopes: manage_order_edits:{projectKey}
calculates Order Preview: false
Query Parameters:
version
- Number - Required
Deletion of an OrderEdit does not affect the order.
Delete OrderEdit by Key
Endpoint: /{projectKey}/orders/edits/key={key}
Method: DELETE
OAuth 2.0 Scopes: manage_order_edits:{projectKey}
calculates Order Preview: false
Query Parameters:
version
- Number - Required
Deletion of an OrderEdit does not affect the order.
Detailed List of StagedOrderUpdateActions
Change OrderState
action
- String -"changeOrderState"
orderState
- OrderState - Required
This update action produces an OrderStateChangedMessage.
Change ShipmentState
action
- String -"changeShipmentState"
shipmentState
- ShipmentState - Required
This update action produces an OrderShipmentStateChangedMessage.
Change PaymentState
action
- String -"changePaymentState"
paymentState
- PaymentState - Required
Changing the payment state of the order produces the OrderPaymentStateChangedMessage.
Update SyncInfo
action
- String -"updateSyncInfo"
channel
- ResourceIdentifier to a Channel
Connection to a particular synchronization destination.externalId
- String - Optional
Can be used to reference an external order instance, file etc.syncedAt
- DateTime - Optional If not provided, then current date would be used
Add ReturnInfo
action
- String -"addReturnInfo"
- RequiredreturnDate
- DateTime - OptionalreturnTrackingId
- String - Optional
Identifies which return tracking ID is connected to this particular return.items
- Array of ReturnItemDraft - Required
Items to be returned.
This update action produces a ReturnInfoAddedMessage.
Set ReturnInfo
action
- String -"setReturnInfo"
items
- Array of ReturnInfoDraft - Optional
Items to be returned.
This update action produces the ReturnInfoSetMessage.
Set ReturnShipmentState
To set a ReturnShipmentState
, there needs to be at least one ReturnInfo with at least one ReturnItem created before.
action
- String -"setReturnShipmentState"
returnItemId
- String - ID of the concerning ReturnItemshipmentState
- ReturnShipmentState
This update action produces an OrderReturnShipmentStateChangedMessage.
Set ReturnPaymentState
To set a ReturnPaymentState
, there needs to be at least one ReturnInfo with at least one ReturnItem created before.
action
- String -"setReturnPaymentState"
returnItemId
- String - ID of the concerning ReturnItempaymentState
- ReturnPaymentState
Change the state of LineItem according to allowed transitions
action
- String -"transitionLineItemState"
lineItemId
- Stringquantity
- NumberfromState
- Reference to a StatetoState
- Reference to a StateactualTransitionDate
- DateTime - Optional
This update action produces a LineItemStateTransitionMessage.
Change the state of CustomLineItem according to allowed transitions
action
- String -"transitionCustomLineItemState"
customLineItemId
- Stringquantity
- NumberfromState
- Reference to a StatetoState
- Reference to a StateactualTransitionDate
- DateTime - Optional
This update action produces a CustomLineItemStateTransitionMessage.
Import State for LineItems
The import of states does not follow any predefined rules and should be only used if no transitions are defined. The quantity in the ItemStates must match the sum of all LineItems states' quantities.
action
- String -"importLineItemState"
lineItemId
- Stringstate
- Array of ItemState
Import State for CustomLineItems
The import of states does not follow any predefined rules and should be only used if no transitions are defined. The quantity in the ItemStates must match the sum of all CustomLineItem states' quantities.
action
- String -"importCustomLineItemState"
customLineItemId
- Stringstate
- Array of ItemState
Add Delivery
A Delivery can only be added to an Order if its shippingInfo
exists.
action
- String -"addDelivery"
items
- Array of DeliveryItem - Optionaladdress
- AddressDraft - Optionalparcels
- Array of ParcelDraft - Optionalcustom
- CustomFieldsDraft - Optional
This update action produces a DeliveryAddedMessage and the ParcelAddedToDeliveryMessage if the action contains a Parcel.
Set Delivery Address
Sets the address
value on an existing Delivery.
action
- String -"setDeliveryAddress"
deliveryId
- String The ID of the Delivery which should be updated.address
- AddressDraft - Optional
If not set an existing address is removed from the delivery.
This update action produces a DeliveryAddressSetMessage.
Add Parcel
To add a Parcel, there needs to be at least one Delivery created before.
action
- String -"addParcelToDelivery"
deliveryId
- String - ID of the Delivery to which the parcel should be added.measurements
- ParcelMeasurements - OptionaltrackingData
- TrackingData - Optionalitems
- Array of DeliveryItem - Optional
This update action produces a ParcelAddedToDeliveryMessage.
Set Order Number
Sets a string that uniquely identifies an order. It can be used to create more human-readable (in contrast to ID) identifier for the order.
action
- String -"setOrderNumber"
orderNumber
- String - Optional
It should be unique across a project. Once it's set, it cannot be changed.
Transition State
Transition to a new state. If there is no state yet, the new state must be an initial state. If the existing state has transitions
set, there must be a direct transition to the new state. If transitions
is not set, no validation is performed. These validations can be turned off by setting the force
parameter to true
.
action
- String -"transitionState"
state
- Reference to a Stateforce
- Boolean - Optional - Defaults tofalse
This update action produces an OrderStateTransitionMessage.
Set Customer Email
This action sets, overwrites, or removes any existing value for customerEmail
.
This action does not change the customer email on the Cart the order has been created from.
action
- String -"setCustomerEmail"
email
- String - Optional
This update action produces an OrderCustomerEmailSetMessage.
Set Customer Id
Relates a Customer to the order. In case the customer belongs to a CustomerGroup the order's field customerGroup
would be updated automatically. When applied, no prices or discounts will be re-calculated on the order.
action
- String -"setCustomerId"
customerId
- String - Optional
If set, a Customer with the given ID must exist in the project.
This update action produces an OrderCustomerSetMessage.
Set Shipping Address
This action sets, overwrites, or removes any existing value for shippingAddress
.
Changing the shipping address does not recalculate the cart. The taxes might not fit to the shipping address anymore.
This action does not change the shipping address on the Cart the order has been created from.
action
- String -"setShippingAddress"
address
- AddressDraft - Optional
This update action produces an OrderShippingAddressSetMessage.
Set Billing Address
This action sets, overwrites, or removes any existing value for billingAddress
.
This action does not change the billing address on the Cart the order has been created from.
action
- String -"setBillingAddress"
address
- AddressDraft - Optional
This update action produces an OrderBillingAddressSetMessage.
Set Custom Type
This action sets, overwrites, or removes any existing custom type and fields for an existing order.
action
- String -"setCustomType"
type
- ResourceIdentifier to a Type - Optional
If set, the custom type is set to this new value.
If absent, the custom type and any existing CustomFields are removed.fields
- A valid JSON object, based on the FieldDefinitions of the Type - Optional
If set, the custom fields are set to this new value.
Set CustomField
This action sets, overwrites, or removes any existing custom field for an existing order.
action
- String -"setCustomField"
name
- String - Requiredvalue
- Value - Optional
Ifvalue
is absent ornull
, this field will be removed if it exists. Trying to remove a field that does not exist will fail with an InvalidOperation error. Ifvalue
is provided, set thevalue
of the field defined by thename
.
Set Shipping Address Custom Type
This action sets, overwrites, or removes any existing custom type and fields for an existing shippingAddress
.
action
- String -"setShippingAddressCustomType"
type
- ResourceIdentifier to a Type - Optional
If set, the custom type is set to this new value.
If absent, the custom type and any existing custom fields are removed.fields
- A valid JSON object, based on the FieldDefinitions of the Type - Optional
If set, the custom fields are set to this new value.
Set Shipping Address CustomField
This action sets, overwrites, or removes any existing custom field for an existing shippingAddress
.
action
- String -"setShippingAddressCustomField"
name
- String - Required
The name of the Custom Field to setvalue
- Value - Optional
Specifies the format of the value of the Custom Field defined byname
. Ifvalue
is absent ornull
, the field specified byname
, if it exists, is removed. Trying to remove a field that does not exist will fail with an InvalidOperation error.
Set Billing Address Custom Type
This action sets, overwrites, or removes any existing custom type and fields for an existing billingAddress
.
action
- String -"setBillingAddressCustomType"
type
- ResourceIdentifier to a Type - Optional
If set, the custom type is set to this new value. If absent, the custom type and any existing custom fields are removed.fields
- A valid JSON object, based on the FieldDefinitions of the Type - Optional
If set, the custom fields are set to this new value.
Set Billing Address CustomField
This action sets, overwrites, or removes any existing custom field for an existing billingAddress
.
action
- String -"setBillingAddressCustomField"
name
- String - Required
The name of the Custom Field to setvalue
- Value - Optional
Specifies the format of the value of the Custom Field defined byname
. Ifvalue
is absent ornull
, the field specified byname
, if it exists, is removed. Trying to remove a field that does not exist will fail with an InvalidOperation error.
Set ItemShipping Address Custom Type
This action sets, overwrites, or removes any existing custom type and fields for an existing itemShippingAddress
.
action
- String -"setItemShippingAddressCustomType"
addressKey
- String - Requiredtype
- ResourceIdentifier to a Type - Optional
If set, the custom type is set to this new value.
If absent, the custom type and any existing custom fields are removed.fields
- A valid JSON object, based on the FieldDefinitions of the Type - Optional
If set, the custom fields are set to this new value.
Set ItemShipping Address CustomField
This action sets, overwrites, or removes any existing custom field for an existing itemShippingAddress
.
action
- String -"setItemShippingAddressCustomField"
addressKey
- String - Requiredname
- String - Required
The name of the Custom Field to setvalue
- Value - Optional
Specifies the format of the value of the Custom Field defined byname
. Ifvalue
is absent ornull
, the field specified byname
, if it exists, is removed. Trying to remove a field that does not exist will fail with an InvalidOperation error.
Set Delivery Address Custom Type
This action sets, overwrites, or removes any existing custom type and fields for an existing address
in a Delivery.
action
- String -"setDeliveryAddressCustomType"
deliveryId
- String - Requiredtype
- ResourceIdentifier to a Type - Optional
If set, the custom type is set to this new value.
If absent, the custom type and any existing custom fields are removed.fields
- A valid JSON object, based on the FieldDefinitions of the Type - Optional
If set, the custom fields are set to this new value.
Set Delivery Address CustomField
This action sets, overwrites, or removes any existing custom field for an existing address
in a Delivery.
action
- String -"setDeliveryAddressCustomField"
deliveryId
- String - Requiredname
- String - Required
The name of the Custom Field to setvalue
- Value - Optional
Specifies the format of the value of the Custom Field defined byname
. Ifvalue
is absent ornull
, the field specified byname
, if it exists, is removed. Trying to remove a field that does not exist will fail with an InvalidOperation error.
Set Delivery Custom Type
This action sets, overwrites, or removes any existing custom type and fields for a existing Delivery.
action
- String -"setDeliveryCustomType"
deliveryId
- String - Requiredtype
- ResourceIdentifier to a Type - Optional
If set, the custom type is set to this new value.
If absent, the custom type and any existing custom fields are removed.fields
- A valid JSON object, based on the FieldDefinitions of the Type - Optional
If set, the custom fields are set to this new value.
Set Delivery CustomField
This action sets, overwrites, or removes any existing custom field for a existing Delivery.
action
- String -"setDeliveryCustomField"
deliveryId
- String - Requiredname
- String - Required
The name of the Custom Field to setvalue
- Value - Optional
Specifies the format of the value of the Custom Field defined byname
. Ifvalue
is absent ornull
, the field specified byname
, if it exists, is removed. Trying to remove a field that does not exist will fail with an InvalidOperation error.
Set Parcel Custom Type
This action sets, overwrites, or removes any existing custom type and fields for a existing Parcel.
action
- String -"setParcelCustomType"
parcelId
- String - Requiredtype
- ResourceIdentifier to a Type - Optional
If set, the custom type is set to this new value.
If absent, the custom type and any existing custom fields are removed.fields
- A valid JSON object, based on the FieldDefinitions of the Type - Optional
If set, the custom fields are set to this new value.
Set Parcel CustomField
This action sets, overwrites, or removes any existing custom field for a existing Parcel.
action
- String -"setParcelCustomField"
parcelId
- String - Requiredname
- String - Required
The name of the Custom Field to setvalue
- Value - Optional
Specifies the format of the value of the Custom Field defined byname
. Ifvalue
is absent ornull
, the field specified byname
, if it exists, is removed. Trying to remove a field that does not exist will fail with an InvalidOperation error.
Set LineItem Custom Type
This action sets, overwrites, or removes the existing custom type and fields for an existing order LineItem.
action
- String -"setLineItemCustomType"
type
- ResourceIdentifier to a Type - Optional
If set, the custom type is set to this new value.
If absent, the custom type and any existing CustomFields are removed at the same time.lineItemId
- Stringfields
- A valid JSON object, based on the FieldDefinitions of the Type - Optional
If set, the custom fields are set to this new value.
Set LineItem CustomField
This action sets, overwrites, or removes any existing custom field for an existing order LineItem.
action
- String -"setLineItemCustomField"
lineItemId
- Stringname
- String - Requiredvalue
- Value - Optional
Ifvalue
is absent ornull
, this field will be removed if it exists. Trying to remove a field that does not exist will fail with an InvalidOperation error. Ifvalue
is provided, set thevalue
of the field defined by thename
.
Set ReturnItem Custom Type
This action sets, overwrites, or removes the existing custom type and fields for an existing order ReturnItem.
action
- String -"setReturnItemCustomType"
type
- ResourceIdentifier to a Type - Optional
If set, the custom type is set to this new value.
If absent, the custom type and any existing CustomFields are removed at the same time.returnItemId
- Stringfields
- A valid JSON object, based on the FieldDefinitions of the Type - Optional
If set, the custom fields are set to this new value.
Set ReturnItem CustomField
This action sets, overwrites, or removes any existing custom field for an existing order ReturnItem.
action
- String -"setReturnItemCustomField"
returnItemId
- Stringname
- String - Requiredvalue
- Value - Optional
Ifvalue
is absent ornull
, this field will be removed if it exists. Trying to remove a field that does not exist will fail with an InvalidOperation error. Ifvalue
is provided, set thevalue
of the field defined by thename
.
Add Payment
This action adds a payment to the PaymentInfo. The payment must not be assigned to another Order or active Cart yet.
Remove Payment
This action removes a payment from the PaymentInfo.
Set Locale
Sets the locale. Must be one of the languages supported for this Project.
action
- String -"setLocale"
locale
- String conforming to IETF language tag - Optional
Set Delivery Items
Updates the delivery items of a Delivery.
action
- String -"setDeliveryItems"
deliveryId
- String - ID of the Delivery for which the items should be setitems
- Array of DeliveryItem
This update action produces a DeliveryItemsUpdatedMessage.
Remove Parcel from Delivery
Removes a parcel in a Delivery.
action
- String -"removeParcelFromDelivery"
parcelId
- String - ID of the Parcel which shall be removed
This update action produces a ParcelRemovedFromDeliveryMessage.
Remove Delivery
Removes a Delivery.
action
- String -"removeDelivery"
deliveryId
- String - ID of the Delivery which shall be removed
This update action produces a DeliveryRemovedMessage.
Set Parcel Measurements
action
- String -"setParcelMeasurements"
parcelId
- String - ID of the Parcel which shall be updatedmeasurements
- ParcelMeasurements - Optional
This update action produces a ParcelMeasurementsUpdatedMessage.
Set Parcel Tracking Data
action
- String -"setParcelTrackingData"
parcelId
- String - ID of the Parcel which shall be updatedtrackingData
- TrackingData - Optional
This update action produces a ParcelTrackingDataUpdatedMessage.
Set Parcel Items
Updates the items of a Parcel.
action
- String -"setParcelItems"
parcelId
- String - ID of the Parcel which shall be updateditems
- Array of DeliveryItem
This update action produces a ParcelItemsUpdatedMessage.
Set LineItemShippingDetails
Sets the ItemShippingDetails for a line item.
action
- String -"setLineItemShippingDetails"
lineItemId
- String
The ID of the line item that is to be updated.shippingDetails
- ItemShippingDetailsDraft - Optional
The new shipping details for the line item.
Set CustomLineItemShippingDetails
Sets the ItemShippingDetails for a custom line item.
action
- String -"setCustomLineItemShippingDetails"
customLineItemId
- String
The ID of the custom line item that is to be updated.shippingDetails
- ItemShippingDetailsDraft - Optional
The new shipping details for the custom line item.
Add ItemShippingAddress
Add an address to the itemShippingAddresses
array.
action
- String -"addItemShippingAddress"
address
- AddressDraft
The address must have a key that is unique in this cart/order.
Remove ItemShippingAddress
Removes an address from the itemShippingAddresses
array. An address can only be removed if it is not referenced in any ItemShippingTarget.
action
- String -"removeItemShippingAddress"
addressKey
- String
The key of the address that is to be removed
Update ItemShippingAddress
Updates an address in the itemShippingAddresses
array.
action
- String -"updateItemShippingAddress"
address
- AddressDraft
The address which is to replace the address with the key already present in the array
Set Store
Updates the Store the order is assigned to. It should be used to migrate existing orders to a newly introduced store. Therefore no validations are performed (such as that the customer is allowed to create orders in the store).
action
- String -"setStore"
store
- ResourceIdentifier to a Store - Optional
This update action produces an OrderStoreSetMessage.
Set OrderTotalTax
Updates the total tax amount of the order if it has the ExternalAmount
TaxMode.
action
- String -"setOrderTotalTax"
externalTotalGross
- Money
The total gross amount of the Order (totalNet + taxes).externalTaxPortions
- Array of TaxPortion - Optional
Set ShippingAddressAndShippingMethod
Sets the shipping address and shipping method together to prevent an inconsistent state.
action
- String -"setShippingAddressAndShippingMethod"
address
- AddressDraftshippingMethod
- ResourceIdentifier of a ShippingMethod - OptionalexternalTaxRate
- ExternalTaxRateDraft - Optional
An external tax rate can be set if the order has theExternal
TaxMode.
Set ShippingAddressAndCustomShippingMethod
Sets the shipping address and a custom shipping method together to prevent an inconsistent state.
action
- String -"setShippingAddressAndCustomShippingMethod"
address
- AddressDraftshippingMethodName
- String - RequiredshippingRate
- ShippingRateDraft - Required
The shipping rate used to determine the price.taxCategory
- ResourceIdentifier of a TaxCategory - Optional
The given tax category will be used to select a tax rate when a order has the TaxModePlatform
.externalTaxRate
- ExternalTaxRateDraft - Optional
An external tax rate can be set if the order has theExternal
TaxMode.
Set Country
Sets the country of the cart. When the country is set, the LineItem prices are updated.
action
- String -"setCountry"
country
- String - Optional
A two-digit country code as per ISO 3166-1 alpha-2.
Set ShippingMethod
Sets the ShippingMethod. Prerequisite: The cart must contain a shipping address. This update action can fail with an InvalidOperation if the referenced shipping method has a predicate which does not match the cart.
action
- String -"setShippingMethod"
shippingMethod
- ResourceIdentifier to a ShippingMethod - OptionalexternalTaxRate
- ExternalTaxRateDraft - Optional
An external tax rate can be set if the cart has theExternal
TaxMode.
Set Custom ShippingMethod
Sets a custom shipping method (independent of the ShippingMethods defined in the project). The custom shipping method can be unset with the setShippingMethod
action without the shippingMethod
. Prerequisite: The cart must contain a shipping address.
action
- String -"setCustomShippingMethod"
shippingMethodName
- String - RequiredshippingRate
- ShippingRateDraft - Required
The shipping rate used to determine the price.taxCategory
- ResourceIdentifier to a TaxCategory - Optional
The given tax category will be used to select a tax rate when a cart has the TaxModePlatform
.externalTaxRate
- ExternalTaxRateDraft - Optional
An external tax rate can be set if the cart has theExternal
TaxMode.
Add DiscountCode
Adds a DiscountCode to the cart to enable the related CartDiscounts.
action
- String -"addDiscountCode"
code
- String - Required
Thecode
of an existing DiscountCode.
The number of discount codes in a cart is limited to 10.
Specific Error Codes:
Remove DiscountCode
Removes a discount code from the cart.
action
- String -"removeDiscountCode"
discountCode
- Reference to a DiscountCode - Required
Set Customer Group
Sets the customer group of the cart. The LineItem prices will be updated according to the customer group.
This action cannot be used if a customer is assigned to the cart. In that case the platform will automatically select the customer group the respective customer is assigned to.
action
- String -"setCustomerGroup"
customerGroup
- ResourceIdentifier to a CustomerGroup - Optional
Set ShippingMethod TaxAmount
A shipping method tax amount can be set if the cart has the ExternalAmount
TaxMode.
action
- String -"setShippingMethodTaxAmount"
externalTaxAmount
- ExternalTaxAmountDraft - Optional
Set ShippingMethod TaxRate
A shipping method tax rate can be set if the cart has the External
TaxMode.
action
- String -"setShippingMethodTaxRate"
externalTaxRate
- ExternalTaxRateDraft - Optional
Change TaxMode
Changes the TaxMode of a cart. When a tax mode is changed from External
to Platform
or Disabled
,
all previously set external tax rates will be removed. When changing the tax mode to Platform
, line items,
custom line items and shipping method require a tax category with a tax rate for the given shipping address.
action
- String -"changeTaxMode"
taxMode
- TaxMode
Change Tax RoundingMode
Changes the tax RoundingMode of a cart. When changing the tax rounding mode, the taxes are recalculated.
action
- String -"changeTaxRoundingMode"
taxRoundingMode
- RoundingMode
Set ShippingRateInput
The shippingRateInput
is used as an input to select a ShippingRatePriceTier. If no matching tier can be found, or the input is not set, the default price is used.
action
- String -"setShippingRateInput"
shippingRateInput
- ShippingRateInputDraft - Optional
Based on the definition of ShippingRateInputType. If CartClassification is defined, it must be ClassificationShippingRateInput. If CartScore is defined, it must be ScoreShippingRateInput. Otherwise it can not bet set.
Change TaxCalculationMode
Changes the TaxCalculationMode of a cart. When changing the tax calculation mode, the taxes are recalculated.
action
- String -"changeTaxCalculationMode"
taxCalculationMode
- TaxCalculationMode
Add Shopping List
Adds all LineItems of a ShoppingList to the cart.
action
- String -"addShoppingList"
shoppingList
- ResourceIdentifier of a ShoppingListsupplyChannel
- ResourceIdentifier of a Channel - Optional
If present a Reference to the channel will be set for all LineItems that are added to the cart.
The channel must have theInventorySupply
channelRoleEnum.distributionChannel
- ResourceIdentifier of a Channel - Optional
If present a Reference to the channel will be set for all LineItems that are added to the cart.
The Channel must have theProductDistribution
ChannelRoleEnum
Add LineItem
Adds a product variant in the given quantity to the cart.
If the cart already contains a line item for the same product variant with the same LineItemMode, custom fields, supply, and distribution channel, then only the quantity of the existing LineItem is increased.
If shippingDetails
are set, they will be merged, meaning all addresses will be present afterwards and, for address keys present in both shipping details, the quantity will be summed up.
A new line item will always be added when the externalPrice
or the externalTotalPrice
is set in this update action.
The LineItem price is set as described in LineItem Price selection.
action
- String -"addLineItem"
- LineItemDraft - Required
Specific Error Codes:
Remove LineItem
Decreases the quantity of the given LineItem. The LineItem price is updated as described in LineItem Price selection.
action
- String -"removeLineItem"
lineItemId
- String - Required
ID of an existing LineItem in the cart.quantity
- Number - Optional If the quantity is absent or the line item quantity drops to less than1
, the line item is removed from the cart.externalPrice
- Money - Optional
Sets the line itemprice
to the given value when decreasing the quantity of a line item with theExternalPrice
LineItemPriceModepriceMode
.externalTotalPrice
- ExternalLineItemTotalPrice - Optional
Sets the line itemprice
andtotalPrice
to the given values when decreasing the quantity of a line item with theExternalTotal
LineItemPriceModepriceMode
.shippingDetailsToRemove
- ItemShippingDetailsDraft - Optional
Container for line item specific address(es) that are to be removed.
Change LineItem Quantity
Sets the quantity of the given LineItem.
If quantity is 0
, the line item is removed from the cart.
The LineItem price is updated as described in LineItem Price selection.
ChangeLineItemQuantity does not support changing the shipping details when multiple shipping addresses are set for one line item. RemoveLineItem and AddLineItem support this, but not ChangeLineItem.
This is the case because it is not possible to deduct how the distribution of sub-quantities should be adapted in accordance with the overall change in the line item quantity.
Thus, the shippingDetails
field will be kept in its current state to avoid data loss.
Use SetLineItemShippingDetails in combination with this update action in one cart update command to change the line item quantity and shipping details together.
action
- String -"changeLineItemQuantity"
lineItemId
- String - Required
ID of an existing LineItem in the cart.quantity
- Number - RequiredexternalPrice
- Money - Optional
Sets the line itemprice
to the given value when changing the quantity of a line item with theExternalPrice
LineItemPriceModepriceMode
.externalTotalPrice
- ExternalLineItemTotalPrice - Optional
Sets the line itemprice
andtotalPrice
to the given values when changing the quantity of a line item with theExternalTotal
LineItemPriceModepriceMode
.
Set LineItem TaxRate
A line item tax rate can be set if the cart has the External
TaxMode.
action
- String -"setLineItemTaxRate"
lineItemId
- StringexternalTaxRate
- ExternalTaxRateDraft - Optional
Set LineItem TaxAmount
A line item tax amount can be set if the cart has the ExternalAmount
TaxMode.
action
- String -"setLineItemTaxAmount"
lineItemId
- StringexternalTaxAmount
- ExternalTaxAmountDraft - Optional
Set LineItem Price
Sets the price
of a line item and changes the priceMode
of the line item to ExternalPrice
LineItemPriceMode.
If the price mode of the line item is ExternalPrice
and no externalPrice
is given, the external price is unset
and the priceMode
is set to Platform
.
action
- String -"setLineItemPrice"
lineItemId
- StringexternalPrice
- Money - Optional
Set LineItem TotalPrice
Sets the totalPrice
and price
of a line item and changes the priceMode
of the line item to ExternalTotal
LineItemPriceMode.
If the price mode of the line item is ExternalTotal
and no externalTotalPrice
is given, the external price is unset
and the priceMode
is set to Platform
.
action
- String -"setLineItemTotalPrice"
lineItemId
- StringexternalTotalPrice
- ExternalLineItemTotalPrice - Optional
Set LineItem DistributionChannel
Sets the distribution channel of the given LineItem.
The LineItem price is updated as described in LineItem Price selection.
action
- String -"setLineItemDistributionChannel"
lineItemId
- String - Required
ID of an existing LineItem in the cart.distributionChannel
- ResourceIdentifier of a Channel - Optional
If present a Reference to the channel will be set for the LineItem specified bylineItemId
. If not present the current Reference to a distribution channel will be removed from the LineItem specified bylineItemId
. The Channel must have theProductDistribution
ChannelRoleEnum
Applying the order edit to change the distribution channel of an order line item produces the OrderLineItemDistributionChannelSetMessage.
Add CustomLineItem
Adds a CustomLineItem to the cart.
If the cart already contains a CustomLineItem with the same slug, name, money, tax category, state, and custom fields, then only the quantity of the existing custom line item is increased.
If shippingDetails
are set, they will be merged, meaning all addresses will be present afterwards and, for address keys present in both shipping details, the quantity will be summed up.
If the cart already contains a custom line item with the same slug that is otherwise not identical, an InvalidOperation error is returned.
action
- String -"addCustomLineItem"
name
- LocalizedStringquantity
- Number - Optional - Defaults to1
money
- Moneyslug
- StringtaxCategory
- ResourceIdentifier to a TaxCategory - Required only forPlatform
TaxMode
The given tax category will be used to select a tax rate when a cart has the tax modePlatform
.externalTaxRate
- ExternalTaxRateDraft - Optional
An external tax rate can be set if the cart has theExternal
TaxMode.custom
- CustomFieldsDraft - Optional
The custom fields.shippingDetails
- ItemShippingDetailsDraft - Optional
Container for custom line item specific address(es).
Specific Error Codes:
Remove CustomLineItem
Removes the custom CustomLineItem from the cart.
Removing a custom line item does not support specifying a quantity, unlike the removal of line items. It's not possible to partially remove shippingDetails
using this update action. See Change CustomLineItem Quantity for that.
action
- String -"removeCustomLineItem"
customLineItemId
- String - Required
ID of an existing CustomLineItem in the cart.
Change CustomLineItem Quantity
Sets the quantity of the given CustomLineItem.
ChangeCustomLineItemQuantity does not support changing the shipping details when multiple shipping addresses are set for one custom line item. AddCustomLineItem support this.
This is the case because it is not possible to deduct how the distribution of sub-quantities should be adapted in accordance with the overall change in the custom line item quantity.
Thus, the shippingDetails
field will be kept in its current state to avoid data loss.
Use SetCustomLineItemShippingDetails in combination with this update action in one cart update command to change the custom line item quantity and shipping details together.
action
- String -"changeCustomLineItemQuantity"
customLineItemId
- String - Required
ID of an existing CustomLineItem in the cart.quantity
- Number - Required
The new quantity being a value >= 0. If quantity is0
, the custom line item will be removed from the cart.
Change CustomLineItem Money
Sets the money of the given CustomLineItem.
action
- String -"changeCustomLineItemMoney"
customLineItemId
- String - Required
ID of an existing CustomLineItem in the cart.money
- Money - Required
The new money.
Set CustomLineItem Custom Type
This action sets, overwrites, or removes the custom type and fields for an existing CustomLineItem.
action
- String -"setCustomLineItemCustomType"
type
- ResourceIdentifier to a Type - Optional
If set, the custom type is set to this new value.
If absent, the custom type and any existing CustomFields are removed at the same time.customLineItemId
- Stringfields
- A valid JSON object, based on the FieldDefinitions of the Type - Optional
If set, the custom fields are set to this new value.
Set CustomLineItem CustomField
This action sets, overwrites, or removes any existing custom field for an existing CustomLineItem.
action
- String -"setCustomLineItemCustomField"
customLineItemId
- Stringname
- String - Requiredvalue
- Value - Optional
Ifvalue
is absent ornull
, this field will be removed if it exists. Trying to remove a field that does not exist will fail with an InvalidOperation error. Ifvalue
is provided, set thevalue
of the field defined by thename
.
Set CustomLineItem TaxRate
A custom line item tax rate can be set if the cart has the External
TaxMode.
action
- String -"setCustomLineItemTaxRate"
customLineItemId
- StringexternalTaxRate
- ExternalTaxRateDraft - Optional
Set CustomLineItem TaxAmount
A custom line item tax amount can be set if the cart has the ExternalAmount
TaxMode.
action
- String -"setCustomLineItemTaxAmount"
customLineItemId
- StringexternalTaxAmount
- ExternalTaxAmountDraft - Optional