Skip to content
Advertisement

paypal sdk ‘Class ‘PayPalRestApiContext’ not found’

I’m trying to implement paypal api sdk using this code

require('vendor/autoload.php');
use PayPalRestApiContext;
use PayPalAuthOAuthTokenCredential;

$api = new ApiContext(
 new OAuthTokenCredential(
    'client id',
    'secret'
 )
);

$api->setConfig([
 'mode'=>'sandbox',
 'http.ConnectionTimeOut'=>30,
 'log.LogEnabled'=>false,
 'log.FileName'=>'',
 'log.LogLevel'=>'FINE',
 'validation.level'=>'log'
]);

The Rest and Auth folders are subfolders of PayPal folder which exists inside the vendor folder. But I get this error “Class ‘PayPalRestApiContext’ not found”

Advertisement

Answer

I am not sure if you are still facing this issue, but I would recommend going through the documentation mentioned here. This should help you find the reason why you are getting this error.

Also, making your first call documentation would really help get you started.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement