Cancel Order

This API cancels an existing order by providing the order ID and the reason for canceling the order. The order can be canceled only when the orders has not processed by the fulfillment center.

Swagger

			
swagger: '2.0'
info:
  x-ibm-name: orders
  title: Orders
  version: 1.0.0
schemes:
  - https
host: $(catalog.host)
basePath: /v1
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  oauth2:
    type: oauth2
    description: ''
    flow: accessCode
    authorizationUrl: 'https://<..........................>/fsc/oauth2/authorize'
    scopes:
      Fulfillment_Returns: ''
    tokenUrl: 'https://<..........................>/fsc/oauth2/token'
  Client_Secret:
    type: apiKey
    description: Enter Client Secret
    in: header
    name: X-IBM-Client-Secret
  Client_Id:
    type: apiKey
    in: header
    name: X-IBM-Client-Id
    description: Enter Client ID
security:
  - Client_Secret: []
    Client_Id: []
    oauth2:
      - Fulfillment_Returns
x-ibm-configuration:
  testable: true
  enforced: true
  phase: realized
paths:
  /orders/{fedexOrderId}:
    delete:
      responses:
        200:
          description: 200 OK
      summary: Cancel Order
      description: Cancels an existing order by providing Order Id and the reason
        for cancel the order. The order can be cancelled only when the orders
        is not processed by the fulfillment center.
      parameters:
      - name: cancelorder_json_input
        required: true
        in: body
        schema:
          type: object
        description: {
			  "order": {
			    "cancelReasonCode": "CCBR"
			  }
			}
      - name: fedexOrderId
        type: string
        required: true
        in: path
        description: FedEx Order Id
      - name: AccessToken
        type: string
        required: true
        in: header
        description: Enter the AccessToken, it is mandatory
			
		

Sample Request

			
{
  "order": {
    "cancelReasonCode": "CCBR"
  }
}
			
		

Sample Response

Success Response

			
{
   "requestIdentifier": "01749ea2-4b8f-4f3d-a9dc-f0b862a3d72e",
   "transactionDate": "2017-01-20T15:12:54-05:00",
   "success": "true",
   "order": {
    “fedexOrderId”: “0001-0007-H0120173742”,
    "orderStatus": "Canceled"
  }
}


			
		

Error Response

			
 {
  "requestIdentifier": "01749ea2-4b8f-4f3d-a9dc-f0b862a3d72e",
  "transactionDate": "2017-01-20T15:12:54-05:00",
  "success": "false",
  "order": {
   “fedexOrderId”: “0001-0007-H0120173760”,
   "orderStatus": "Shipped"
 },
 "errors": [
   {
     "code": "ERR-ORD-0026",
     "description": "Order cannot be canceled. Order is being processed or already shipped"
   }
  ]
}


			
		

OAuth 2.0

HTTP Headers Description
Authorization You must always provide the access token for authorization to access the API.

HTTP-Header       Value
Authorization       Bearer accessToken
Origin Origin URL.

HTTP-Header       Value
Origin                domain.com

Custom authentication

HTTP Headers Description
X-IBM-Client-Id You must always provide in the HTTP header your API portal application's client ID (X-IBM-Client-Id) to access the API.

HTTP-Header       Value
X-IBM-Client-Id     ************
X-IBM-Client-Secret You must always provide in the HTTP header your API portal application's client secret (X-IBM-Client-Secret) to access the API.

HTTP-Header       Value
X-IBM-Client-Secret     ************
AccessToken Application Access Token
Origin Origin URL.

HTTP-Header       Value
Origin                domain.com

Request Attribute

Parameter Data Type Description Required
order      
cancelReasonCode String Reason code to cancel the order
Valid values:
CCBR - Customer Cancellation: Buyer's Remorse
CCOM - Customer Cancellation: Ordered By Mistake
CCOI - Customer Cancellation: Ordered Incorrect Product
INIV - Insufficient Inventory
PMTF - Payment Fraud
PMTR - Payment Rejected
OTHR - Other
Y

Response Attribute

Parameter Data Type Description
requestIdentifier String Request identifier
transactionDate String Transaction date/time
success String Status of the transaction
Valid Values:
true
false
order    
fedexOrderId String FedEx order ID generated by the system
orderStatus String Status of the order
errors[]    
code String Code associated with the error
description String Description of the error

HTTP Status Code

Code Description
200 OK - HTTP Response for successfully processed requests
400 Bad Request.
403 Forbidden
404 Not Found - Server couldn’t find anything matching request URI
500 Internal Server Error – Unable to process the request

Error Code

Code Description
ERR-SYS-0001 Your request cannot be processed due to a system error.
ERR-CMR-0001 Input data validation failed.
ERR-CMR-0002 Authentication Failed. Invalid Access Token.
ERR-CMR-0003 Missing mandatory fields.
ERR-ORD-0001 External order id is missing
ERR-ORD-0002 Order Date - Invalid format
ERR-ORD-0003 SKU is missing
ERR-ORD-0004 Order arrived with missing or invalid SKU
ERR-ORD-0005 Item quantity is missing
ERR-ORD-0006 Quantity value is invalid
ERR-ORD-0007 Retail price is invalid
ERR-ORD-0008 Name is missing
ERR-ORD-0009 Address Line 1 is missing
ERR-ORD-0010 City is missing
ERR-ORD-0011 State code is missing
ERR-ORD-0012 Zip code is missing
ERR-ORD-0013 Country code is missing
ERR-ORD-0014 Invalid e-mail address
ERR-ORD-0015 Missing phone number
ERR-ORD-0016 Invalid delivery type
ERR-ORD-0017 Shipping type is missing
ERR-ORD-0018 Invalid shipping type value
ERR-ORD-0019 Shipping method is missing
ERR-ORD-0020 Invalid shipping method value
ERR-ORD-0021 Client ID is missing
ERR-ORD-0022 Order already exists
ERR-ORD-0023 SKU does not exist
ERR-ORD-0024 Order does not exist
ERR-ORD-0025 Order cannot be updated. Order is being processed or already shipped
ERR-ORD-0026 Order cannot be canceled. Order is being processed or already shipped
ERR-ORD-0027 Cancel reason code is missing or invalid
ERR-ORD-0028 Order arrived with a non-US country code. International orders are not allowed through this API call
ERR-ORD-0029 Request cannot be processed with more than 25 orders in the filter.
ERR-ORD-0030 Sales channel and order number should be used together to filter the orders by Sales channel.
ERR-ORD-0031 FedEx order ID and Order Number cannot be used together to filter the orders.
ERR-ORD-0032 Time stamp filter is not in the required format.
ERR-ORD-0033 Time stamp and condition type should be used together to filter orders based on Timestamp
ERR-ORD-0034 Invalid Condition type value
ERR-ORD-0035 Invalid response filter value
ERR-ORD-0037 Order arrived with inactive SKU
ERR-ORD-0046 Connection is inactive
ERR-ORD-0047 Hold until date cannot be in the past
ERR-ORD-0051 Search criteria did not return any results
ERR-ORD-0052 Hold until date - Invalid format
ERR-ORD-0054 International shipping is not enabled
ERR-ORD-0055 Order contains some SKUs with missing information that is mandatory for International shipping
ERR-ORD-0056 Invalid facility code
ERR-ORD-0057 Invalid country code
ERR-ORD-0058 Freight costs are in invalid format
ERR-ORD-0059 Insurance costs are in invalid format
ERR-ORD-0060 Duties and taxes are in invalid format
ERR-ORD-0061 Invalid order type
ERR-ORD-0063 Note code is invalid or missing.
ERR-ORD-0064 Invalid estimated delivery date.