client class not found,,
bhautikdream4u opened this issue · 1 comments
bhautikdream4u commented
Please help me to fix this error in joomla..
i include class.php file and call that class but it giving me error about class not found.
if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR);
require_once (JPATH_ROOT.DS.'components'.DS.'com_eshop'.DS.'plugins'.DS.'payment'.DS.'AmazonPay'.DS.'Client.php');
$config = array(
'merchant_id' => 'YOUR_MERCHANT_ID',
'access_key' => 'YOUR_ACCESS_KEY',
'secret_key' => 'YOUR_SECRET_KEY',
'client_id' => 'YOUR_LOGIN_WITH_AMAZON_CLIENT_ID',
'region' => 'REGION',
'sandbox' => true);
$client = new Client($config);
// Also you can set the sandbox variable in the config() array of the Client class by
$client->setSandbox(true);
nlubisch commented
The Client itself is contained in the namespace "AmazonPay".
So your instantiation of the Client should be
$client = new \AmazonPay\Client($config);
or you could use following notation after your PHP opening tag to be able to use "Client" only
<?php
//if used
namespace XXX;
use AmazonPay\Client;
//...
$client = new Client($config);
//...