Integration and Testing

Authorize.Net API questions and help with your payment integration.

Posts: 2
Registered: ‎03-23-2020

PHP SDK issue



I've got the SDK installed via Composer and here is the path:




I'm loading it like this:


require $_SERVER["DOCUMENT_ROOT"].'/anet_php_sdk/vendor/autoload.php';


There are no load errors and I checked by changing "vendor" to "vendors" and it gave an error.


So now I'm trying to set the API credentials as per like so:


use net\authorize\api\contract\v1 as AnetAPI;


but when I test the page I get this:


Parse error: syntax error, unexpected 'use' (T_USE) in /path/to/file/file.php on line 209


Any thoughts are greatly appreciated.



Posts: 2
Registered: ‎03-23-2020

Re: PHP SDK issue

All, I have solved this. For anyone else who may encounter this issue, the "use" code cannot be inside a function, it needs to be available globally.