Composer Installed Package with WordPress Rest API Endpoint

I am trying to use the Square SDK with a WordPress website. I installed Composer and the Square SDK. I created a WP_Rest_API, but when trying to use the Square classes inside of the .php file, I get an error.

  1. I created a new plugin in my wordpress plugins folder.
  2. In the .php file inside my plugin, I require the "autoload.php" file of Composer from my root directory.
  3. When trying to use the classes from the Square SDK I get an error.

Why?

Thank you!