Graph API Version

Commerce Order Cancellation

Reading

Cancellations on an order

New Page Experience

This endpoint is supported for New Page Experience.

Example

Graph API Explorer
GET v24.0/...?fields={fieldname_of_type_CommerceOrderCancellation} HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->get(
    '...?fields={fieldname_of_type_CommerceOrderCancellation}',
    '{access-token}'
  );
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
    "...?fields={fieldname_of_type_CommerceOrderCancellation}",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "...?fields={fieldname_of_type_CommerceOrderCancellation}",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"...?fields={fieldname_of_type_CommerceOrderCancellation}"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
If you want to learn how to use the Graph API, read our Using Graph API guide.

Parameters

This endpoint doesn't have any parameters.

Fields

FieldDescription
id
numeric string

Cancellation ID

cancel_reason

Reason for the cancellation

Creating

You can make a POST request to cancellations edge from the following paths:
When posting to this edge, a CommerceOrderCancellation will be created.

Parameters

ParameterDescription
cancel_reason
JSON object

Reason for cancellation of items(s) or order

reason_code
enum {CUSTOMER_REQUESTED, OUT_OF_STOCK, INVALID_ADDRESS, SUSPICIOUS_ORDER, CANCEL_REASON_OTHER, ITEM_NOT_PICKED_UP}

Code for the cancel reason.

reason_description
string

Description for the cancel reason.

idempotency_key
string

Idempotency key for the request

Required
items
array<JSON object>

Items to be canceled along with the quantity

retailer_id
string

retailer_id

quantity
int64

quantity

Required
restock_items
boolean
Default value: false

Whether the items canceled are to be restocked

Return Type

This endpoint supports read-after-write and will read the node to which you POSTed.
Struct {
success: bool,
}

Error Codes

ErrorDescription
100Invalid parameter

Updating

You can't perform this operation on this endpoint.

Deleting

You can't perform this operation on this endpoint.