amzn / amazon-pay-sdk-php

Amazon Pay PHP SDK

Home Page:https://pay.amazon.com/documentation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

client class not found,,

bhautikdream4u opened this issue · comments

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);

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);
//...