Order Change
In this document, you’ll learn how to make changes to an order, such as return or exchange an item.
What's an Order Change?
An order change is modifying the order’s items for business purposes. For example, when a customer requests to return an item, or when you suggest exchanging an item with another.
Order changes are represented by the OrderChange
data model.
Order Change Actions
An order change can have multiple underlying actions. For example, to exchange an item, you have to:
- Mark an item as returned.
- Arrange to receive the item from the customer.
- Add the new item to be sent to the customer.
- Fulfill the item and send it to the customer.
Each of these actions is represented by the OrderChangeAction
data model.
Action Name
The action
attribute of the OrderChangeAction
holds the name of the action to perform. Based on the action, additional details are stored in the details
object attribute of the data model.
Action Name | Description | Expected details |
---|---|---|
| Adds a new item to the order. |
For example:
|
| Removes an item from the order. |
For example:
|
| Removes a quantity of an item. |
|
| Request a return of an item. |
|
| Mark as received an item whose return was previously requested. |
|
| Mark as received an item whose return was previously requested, but consider the items damaged. This changes the order item’s |
|
| Cancel a previously requested return of an item. |
|
| Add a shipping method to an item. |
|
| Mark a quantity of an item as shipped. This modifies the shipped_quantity attribute of an order item. |
|
| Mark a quantity of an item as fulfilled. This modifies the fulfilled_quantity attribute of an order item. |
|
| Cancel the order change. | Doesn’t expect any data. |
Action Chaining
Actions are chained one after the other, similar to the example in the earlier section. This also allows you to cancel or undo some actions.
For example, if you request an order return with RETURN_ITEM
action, you can later cancel it with the CANCEL_RETURN
action.
The actions are ordered by the ordering
attribute of the OrderChangeAction
data model.
Action Amount
The OrderChangeAction
data model has an amount
attribute that indicates a change in the order’s amount that this action incurs.
Order Change Confirmation
The OrderChange
data model has a status
attribute that indicates its current status. By default, it’s pending. At this point, the order change’s actions aren’t applied to the order yet.
To apply these changes to the order, you must confirm the order change. When the order change is confirmed:
- The status of the order change is changed to
confirmed
. - The order’s items are changed based on the order change’s actions. For example, an item is added, or an existing item’s quantity is changed.
- The order summary is modified to reflect new changes.
If there are changes to the order’s total amount due to refunding or capturing payment, they must be added as transactions first. Otherwise, they won’t be accounted for when modifying the order summary