Troubleshooting Your Commerce Platform Integration

In order to understand the commerce setup for a merchant you might want to confirm what assets are used:

Get Commerce Merchant Settings ID

CMS-ID is a Commerce Merchant Settings ID for commerce integration.

If you are using commerce manager redirect this id should be returned in the redirection parameters. Alternatively you can ask a merchant to provide your id or pull CMS-ID from the business object.

  1. A merchant can find CMS-ID by logging into Facebook Commerce Manager and then selecting the commerce account. The merchant will be redirected to www.facebook.com/ commerce_manager/{CMS-ID}.

  2. Pulling CMS-ID from the business object:

Sample Request

Graph API Explorer
curl -X GET -G \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/{business-id}/fields=commerce_merchant_settings
GET /{business-id}/fields=commerce_merchant_settings 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(
    '/{business-id}/fields=commerce_merchant_settings',
    '{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(
    "/{business-id}/fields=commerce_merchant_settings",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);

Sample Response

{
  "id": "123456789"
}

If your merchant has more than one commerce merchant settings you can query Instagram channel or page name in order to verify where orders are coming from.

Get Page, Catalog IDs

You can read a merchant's settings by ID. The onsite_commerce_merchant field is only returned for Shops configured for onsite Checkout.

Sample Request

Graph API Explorer
curl -X GET -G \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/{CMS-ID}?fields=merchant_page,product_catalogs
GET /{CMS-ID}?fields=merchant_page,product_catalogs 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(
    '/{CMS-ID}?fields=merchant_page,product_catalogs',
    '{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(
    "/{CMS-ID}?fields=merchant_page,product_catalogs",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);

Sample Response

Shop configured for onsite Checkout:

{
  "merchant_page": {
    "id": "4040",
    "name": "Checkout Page"
  },
  "product_catalogs": {
    "data": [
      {
        "id": "33799",
        "name": "Products for Checkout"
      }
    ]
  },
  "id": "1234567890"
}

Shop not configured for onsite Checkout (old Shops API):

{
  "id": "1234567890"
}

Otherwise a relevant error message will be returned.

Get Business ID

In order to get a merchant business ID you need to know either page or catalog IDs from them (you can get these IDs from CMS-ID). Both catalog and page objects have business edge that can provide you information about the business.

Sample Request

Graph API Explorer
curl -X GET -G \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/{Page-ID}?fields=business
GET /{Page-ID}?fields=business 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(
    '/{Page-ID}?fields=business',
    '{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(
    "/{Page-ID}?fields=business",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);

Sample Response

{
  "business": {
    "id": "1234567890123",
    "name": "A merchant business name"
  },
  "id": "1234567890"
}

Facebook channel

Sample Request

Graph API Explorer
curl -X GET -G \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/{CMS-ID}/facebook_channel
GET /{CMS-ID}/facebook_channel 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(
    '/{CMS-ID}/facebook_channel',
    '{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(
    "/{CMS-ID}/facebook_channel",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);

Sample Response

{
  "facebook_channel": {
    "pages": {
      "data": [
        {
          "name": "Checkout Page",
          "id": "4040"
        }
      ]
    }
  },
  "id": "123456789890"
}

Instagram channel

Sample Request

Graph API Explorer
curl -X GET -G \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/{CMS-ID}/instagram_channel
GET /{CMS-ID}/instagram_channel 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(
    '/{CMS-ID}/instagram_channel',
    '{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(
    "/{CMS-ID}/instagram_channel",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);

Sample Response

{
  "instagram_channel": {
    "instagram_users": {
      "data": [
        {
          "id": "1234"
        }
      ]
    }
  },
  "id": "123456789890"
}

Setup status

For more info on the shop setup status please read here.