Как стать счастливее и уверенно идти к своим целям? Все ответы — в книге «Сам себе государство. Как совершить революцию в жизни». Купить Troubleshooting - Commerce Platform - Documentation - Facebook for Developers

Troubleshoot Your Commerce Platform Integration

To understand the commerce setup for a seller, consider confirming what assets are used:

Get Commerce Merchant Settings ID

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

If you are using a Commerce Manager redirect, this ID should be returned in the redirection parameters. Alternatively, you can ask a seller to provide your ID or pull CMS-ID from the business object.

  1. A seller can find the CMS-ID by logging into Facebook Commerce Manager and then selecting the commerce account. The seller 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 seller has more than one commerce merchant settings you can query Instagram channel or page name to verify where orders are coming from.

Get Page, Catalog IDs

You can read a seller'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

To get a seller business ID, you need to know either the 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}?fields=facebook_channel
GET /{CMS-ID}?fields=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}?fields=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}?fields=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}?fields=instagram_channel
GET /{CMS-ID}?fields=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}?fields=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}?fields=instagram_channel",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);

Sample Response

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

Onsite or Offsite Configuration

In order to check if a commerce account setup as offsite or onsite use the commerce merchant settings parameter cta.

Sample Request

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

Sample Response

{
  "cta": "ONSITE_CHECKOUT"
  
}

Setup Status

There are few statuses that are required to see if the seller is correctly set up.

  1. First check that shop_setup field must be in SETUP state.

  2. Lack of payment setup is indicated in the payment_setup field.

  3. Shops will not be visible to public unless review_status is in APPROVED state. See review_status_code for details.

  4. We recommend checking facebook_channel and instagram_channel to see that Facebook Shops and Instagram Shopping channels are enabled. For more details see Facebook channel and Instagram channel.

  5. Separately to commerce setup seller Instagram account must be approved for the Shopping functionality, otherwise there will be no distribution of the seller products on Instagram and no commerce orders. Instagram Shopping approval status is no part of commerce API.

Sample Request

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

Response

AttributeTypeDescription

shop_setup

shop_setup_status

Status of the Commerce account.

payment_setup

payment_setup_status

Status of the seller payment details.

review_status

review_status

Status of Facebook's seller integrity review.

shop_setup_status

ValueDescription

NOT_SETUP

SETUP

UNDER_REVIEW

PENDING_PAGE_APPROVAL

PENDING_TOS_ACCEPTANCE

EXTERNALLY_DISABLED

payment_setup_status

ValueDescription

NOT_SETUP

SETUP

VERIFICATION_NEEDED

UNDER_REVIEW

review_status

AttributeTypeDescription

status

review_status_code

Enum representing review status.

reasons

Array of review_status_reason

If the review status is REJECTED, this contains descriptions of reasons for rejection.

review_status_code

ValueDescription

APPROVED

IN_REVIEW

Sellers need to wait for the review to complete for their Shops to be visible to public. The process can take up to 28 days.

REJECTED

Rejected sellers have to delete the CMS and set up with different credentials such as bank account.

INTEGRITY_NOT_CHECKED

Integrity review was waived

review_status_reason

AttributeTypeDescription

code

String

Enum representing rejection reason. Possible values are UNKNOWN.

message

String

Description of rejection reason.

help_url

String

A link to view more details about the review and rejection.

Sample Response

{
  "data": [
    {
      "shop_setup": "SETUP",
      "payment_setup": "SETUP",
      "review_status": {
        "status": "REJECTED",
        "reasons": [
          {
            "code": "UNKNOWN",
            "message": "Your account is not eligible for Facebook Shops at this time.",
            "help_url": "https://www.facebook.com/help/contact/481136396104354"
          }
        ]
      }
    }
  ]
}