cancel
Showing results for 
Search instead for 
Did you mean: 

PHP SDK issue

Hello,

 

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

 

/anet_php_sdk/vendor/autoload.php

 

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 https://github.com/AuthorizeNet/sdk-php 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.

 

Chris

idextrus
Member
1 REPLY 1

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.

idextrus
Member