Cancel customer order for WFS item

Call this endpoint to cancel a previously created Walmart Fulfillment Services (WFS) fulfilled customer order for your Walmart Multichannel solutions (MCS) channels. Use this API before fulfillment progresses, for instance before a line ships. If a line is already shipped or is in a non-reversible state it cannot be cancelled.

This page describes an example using only the required parameters and inputs to cancel a customer order for WFS item. For a full list of customization options and additional capabilities, refer to the Marketplace WFS Multichannel solutions API Reference.

Endpoint

POST https://marketplace.walmartapis.com/v3/fulfillment/orders-fulfillments/cancel

Sample request

Use this sample to request cancellation of one or more unshipped lines on a previously created WFS fulfilled MCS order.

curl --request POST \ --url https://marketplace.walmartapis.com/v3/fulfillment/orders-fulfillments/cancel \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --header 'WM_SEC.ACCESS_TOKEN: <access_token>' \ --header 'WM_QOS.CORRELATION_ID: <uuid>' \ --header 'WM_SVC.NAME: Walmart Marketplace' \ --data '
{ "header": { "headerAttributes": { "buId": "0", "martId": "202" } }, "payload": { "customerOrderNo": "sellername001ABC123", "orderItems": [ { "sellerLineId": "1232456", "qty": { "unitOfMeasure": "EACH", "measurementValue": 2 } } ] }
}
'
import requests url = "https://marketplace.walmartapis.com/v3/fulfillment/orders-fulfillments/cancel" headers = { "Accept": "application/json", "Content-Type": "application/json", "WM_SEC.ACCESS_TOKEN": "<access_token>", "WM_QOS.CORRELATION_ID": "<uuid>", "WM_SVC.NAME": "Walmart Marketplace",
} json_data = { "header": { "headerAttributes": { "buId": "0", "martId": "202" } }, "payload": { "customerOrderNo": "sellername001ABC123", "orderItems": [ { "sellerLineId": "1232456", "qty": { "unitOfMeasure": "EACH", "measurementValue": 2 } } ] }
} response = requests.post(url, headers=headers, json=json_data)
print(response.status_code)
print(response.text) 

Modify your code

  • Use a unique WM_QOS.CORRELATION_ID for each request.
  • Replace WM_SEC.ACCESS_TOKEN with your valid access token obtained through authentication.
  • Supply your customerOrderNo and the orderItems to cancel; lines already shipped or locked cannot be canceled.

Sample response

The API returns a successful response when the order is successfully cancelled.

{ "status": "ACCEPTED", "header": { "headerAttributes": { "buId": "0", "martId": "202" } }, "payload": { "requestId": "594ef12e-0d0f-402d-aab9-3f7ca06b0ed7" }
}

If the request fails, the API responds as follows.

{ “status”: “FAIL”, “errors”: [ { “code”: “404.WSAAS.100", “description”: “Data not found in WSAAS”, “info”: “requested order not found”, “severity”: “ERROR”, “category”: “REQUEST” } ] }

Result

The specified eligible lines are cancelled and any reserved inventory is released back to WFS. Partial cancellations are possible, cancellable lines are cancelled and in-flight or shipped lines remain the same. For the cancelled lines, now new shipments are created and existing shipments that are already in progress are unaffected.