Enable returns on partially fulfilled orders

Commerce can optionally support returns on partially fulfilled orders.

By default, an item received by a shopper can be returned only if the order that it is part of has been fulfilled completely. For example, suppose an order contains two items, and only one item is shipped to the shopper because the other item is out of stock. If the shopper decides to return the first item, he or she must wait until the second item arrives.

This section describes how to enable returns on partially fulfilled orders, so shoppers can return received items even if not all of the items in the order have been received. Note that this feature is currently supported only through the REST APIs.

Enable returns

If you want to allow shoppers to return items in orders that have been only partially fulfilled, use the updateCloudConfiguration endpoint in the Admin API to set the allowReturnOnPartiallyFulfilledOrder property to true. For example:

PUT /ccadmin/v1/merchant/cloudConfiguration  HTTP/1.1
Authorization: Bearer <access_token>
Content-Type: application/json

{
  "allowReturnOnPartiallyFulfilledOrder": true
}

Modify the order state

This example illustrates using the Admin API to mark one of the items in an order as delivered. The order contains two items, but only one item has been delivered because the other is out of stock. Both items have the same shipping address and use the same shipping method.

  1. Call the getOrder endpoint in the Admin API to view the order. For example:
    GET /ccadmin/v1/orders/o20005

    The response shows the data from the order. The order should have one shipping group with two commerceItemRelationships objects (a separate object for each item).

  2. Call the updateOrder endpoint in the Admin API and update the state of the commerceItemRelationships object associated with the delivered item to DELIVERED.

Initiate the return

To initiate the return of the delivered item, you use either the Agent API or the Store API. This section illustrates using the Agent API.

  1. Call the handleOrderActions endpoint in the Agent API to check if the order is returnable. For example:
    POST /ccagent/v1/orders/o20005
    {"op": "validActions"}

    The response should show the isReturnOrder flag as true. If isReturnOrder is false, items in the order cannot be returned.

  2. Initiate a return request for the above order using the Agent API initiateReturn endpoint. For example:
    POST /ccagent/v1/returnRequests
    {
        "op": "initiateReturn",
             "orderId": "o20005"
    }

    The response includes a list of the items in the order. For an item that has not been delivered yet, the nonreturnable property is true and the nonReturnableReason property indicates that the item has not been delivered.

  3. Now create the return request using the initiateReturn endpoint with "op": "createReturnRequest", and specify the item to be returned.

    Once the return request is created, the remainder of the return flow (such as receiving the returned item and processing the refund) can be performed using the UI.