I had download the PHP PayPal SDK here. Now trying to add the autoload and use use PayPal\Rest\ApiContext but it is continuously prompting error message.
sdk location -> /application/libraries/PayPal_PHP_SDK/
Error Message
I had a controller named PayPal.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
// require APPPATH . 'libraries/vendor/autoload.php';
require APPPATH . 'libraries/vendor/PayPal_PHP_SDK/autoload.php';
use PayPal\Rest\ApiContext;
use PayPal\Auth\OAuthTokenCredential;
class Paypal extends CI_Controller {
public function __construct(){
parent::__construct();
$this->load->library('session');
$this->load->helper(array('form', 'url'));
}
public function index() {
// After Step 1
$apiContext = new \PayPal\Rest\ApiContext(
new \PayPal\Auth\OAuthTokenCredential(
'AeH73iyUSw2E_A6VRzeiyxfxR8QL9wy09XUIj5rUp42Uh9s3sQbHQTv2UdbVSx8cFGGwaapxxxxxxxxx',
// ClientID
'ELEN6UgB4phJT2Onwk4GjQqYyEobN_Hd-eKWlZCYMxtucsc-ZavqmKHnRSvfAknM6pjBUOxxxxxxxxxx'
// ClientSecret
)
);
echo '<pre>';print_r($apiContext);exit;
echo "paypal";
}
I had tried by composer and direct download both but still facing same error message. What am I missing, please guide your help will be appreciated.