Troubleshooting - "Failed to connect to Magento 2 API"


If you have completed all of the steps in our integration guide to set up a connection from your Subscribe Pro environment to your Magento 2 store and see the error below when clicking the Verify button, you will need to take the following measures to troubleshoot the connection.

Failed to connect to Magento 2 API.

Check Base URL

Check the Base URL you have entered into the store connection settings. In most cases, this is the base URL of your Magento store, followed by /rest/.

According to Magento's documentation, the base URL should be: https://<MAGENTO_HOST_OR_IP>/<MAGENTO_BASE_INSTALL_DIR>/rest/.

HTTP Basic Authentication Not Supported

If you have HTTP Basic Authentication enabled (as is sometimes the case with test and staging sites) to restrict access to your store, you will need to remove it, as Subscribe Pro does not support that authentication type.

Check Firewall IP Address Restrictions

If you have a firewall on your Magento server that restricts access to a certain list of IP addresses (i.e. an IP whitelist), you will need to ensure the Subscribe Pro Platform Server IP Addresses have been allowed.

Confirm Store View Code

Store View Code

Double check the "Store View Code". In a "vanilla" Magento installation, the "Main Website" store view code is default. If you have changed this or added another store, this value may be different for you.

Check OAuth 2.0 Credentials

Double check your four OAuth 2.0 credentials that you copied over from the Magento 2 integration. If any of these is incorrect, it will not allow you to connect.

Test Magneto 2 Connection with cURL

You can use the following cURL command to perform the same request Subscribe Pro does when attempting to connect.

curl -X POST 'https://{baseUrl}/rest/V1/carts' \
    -H "Authorization: Oauth oauth_consumer_key={consumer_key}" \
    "&oauth_token={oauth_token}" \
    "&oauth_signature_method=HMAC-SHA1" \
    "&oauth_timestamp={timestamp}" \
    "&oauth_nonce={oauth_nonce}" \
    "&oauth_version=1.0" \
    "&oauth_signature={oauth_signature}"

You can find more details about the values required in the above command from Magento's documentation.