0

i am trying to use amazonpay and encounter the following problem;

when i if ($whatever) require_once("amazonpay_stuff.php") with content:

namespace AmazonPay
require_once "apay/config.php";
include 'apay/amazon-pay.phar';

and then in the same file where i have the require i try to use

$client = new Client($amazonpay_config);

this does not work and i get error message

Fatal error: Class 'Client' not found in ....

when i have all that code in one file;

namespace AmazonPay
require_once "apay/config.php";
include 'apay/amazon-pay.phar';
$client = new Client($amazonpay_config);

it works fine - how can i make it work with require_once?

Janus
  • 41
  • 3
  • Hi @Janus, I guess you have to watch your namespace handling. Have you tried just using $client = new \AmazonPay\Client($amazonpay_config); everywhere? – marcus.kreusch Dec 09 '20 at 12:10
  • hi @marcus.kreusch thank you for your help, but that did not work :-/ still the "Fatal error: Class 'Client' not found in /www/htdocs/...." error - i tried it with \AmazonPay\Client ... and AmazonPay\Client – Janus Dec 09 '20 at 18:20

0 Answers0