I want to integrate the PayPal REST PHP SDK into my phalcon project. You can find the SDK here:
The documentation of this SDK says, that I have to include the autoloader.php file in my project:
"If your application has a bootstrap/autoload file, you should add include '<vendor directory location>/vendor/autoload.php' in it. The location of the <vendor directory> should be replaced based on where you downloaded vendor directory in your application."
So I tried several things:
include($config->application->libraryDir . "paypal-vendor/autoload.php");
$loader->registerDirs(array( $config->application->controllersDir, $config->application->modelsDir, $config->application->libraryDir, $config->application->libraryDir . "paypal-vendor/", $config->application->pluginsDir, $config->application->langDir, ));
I inserted the namespaces into my controller file:
use PayPal\Rest\ApiContext; use PayPal\Auth\OAuthTokenCredential; use PayPal\Api\Payment;
But when I want to create an object like this:
$apiContext = new ApiContext(new OAuthTokenCredential('<clientId>', '<clientSecret>'));
I got an error:
> Fatal error: Class 'PayPal\Rest\ApiContext' not found in .../app/controllers/IndexController.php on line 23
What am I doing wrong?
Thanks for your help!