Classes don't autoload with Adyen php-api-library?
up vote
0
down vote
favorite
I am trying to get the Adyen php-api-library working, but i get the message:
Fatal error: Class 'ServicePayment' not found
The error message makes me to believe the class payment is not being loaded, but how do i make sure / fix this?? I thought composer would do the job.
I am devolping on a local XAMPP (mac)
- i have installed with composer
- simple test.php
> composer require adyen/php-api-library Using version ^1.5 for
> adyen/php-api-library ./composer.json has been created Loading
> composer repositories with package information Updating dependencies
> (including require-dev) Package operations: 3 installs, 0 updates, 0
> removals
> - Installing psr/log (1.0.2): Loading from cache
> - Installing monolog/monolog (1.24.0): Downloading (100%)
> - Installing adyen/php-api-library (1.5.3): Downloading (100%) monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log
> messages to AWS services like DynamoDB) monolog/monolog suggests
> installing doctrine/couchdb (Allow sending log messages to a CouchDB
> server) monolog/monolog suggests installing ext-amqp (Allow sending
> log messages to an AMQP server (1.0+ required)) monolog/monolog
> suggests installing ext-mongo (Allow sending log messages to a MongoDB
> server) monolog/monolog suggests installing graylog2/gelf-php (Allow
> sending log messages to a GrayLog2 server) monolog/monolog suggests
> installing mongodb/mongodb (Allow sending log messages to a MongoDB
> server via PHP Driver) monolog/monolog suggests installing
> php-amqplib/php-amqplib (Allow sending log messages to an AMQP server
> using php-amqplib) monolog/monolog suggests installing
> php-console/php-console (Allow sending log messages to Google Chrome)
> monolog/monolog suggests installing rollbar/rollbar (Allow sending log
> messages to Rollbar) monolog/monolog suggests installing
> ruflin/elastica (Allow sending log messages to an Elastic Search
> server) monolog/monolog suggests installing sentry/sentry (Allow
> sending log messages to a Sentry server) Writing lock file Generating
> autoload files
test.php
require __DIR__ . '/vendor/autoload.php';
$client = new AdyenClient();
$client->setApplicationName("Adyen PHP Api Library Example");
$client->setUsername("xxxx");
$client->setPassword("xxxxx");
$client->setXApiKey("xxxxxxxxxxx");
$client->setEnvironment(AdyenEnvironment::TEST);
$service = new ServicePayment($client);
$json = '{
"card": {
"number": "4111111111111111",
"expiryMonth": "03",
"expiryYear": "2030",
"cvc": "737",
"holderName": "John Smith"
},
"amount": {
"value": 1500,
"currency": "EUR"
},
"reference": "payment-test",
"merchantAccount": "ourshopcom"
}';
$params = json_decode($json, true);
$result = $service->authorise($params);
php composer-php adyen
add a comment |
up vote
0
down vote
favorite
I am trying to get the Adyen php-api-library working, but i get the message:
Fatal error: Class 'ServicePayment' not found
The error message makes me to believe the class payment is not being loaded, but how do i make sure / fix this?? I thought composer would do the job.
I am devolping on a local XAMPP (mac)
- i have installed with composer
- simple test.php
> composer require adyen/php-api-library Using version ^1.5 for
> adyen/php-api-library ./composer.json has been created Loading
> composer repositories with package information Updating dependencies
> (including require-dev) Package operations: 3 installs, 0 updates, 0
> removals
> - Installing psr/log (1.0.2): Loading from cache
> - Installing monolog/monolog (1.24.0): Downloading (100%)
> - Installing adyen/php-api-library (1.5.3): Downloading (100%) monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log
> messages to AWS services like DynamoDB) monolog/monolog suggests
> installing doctrine/couchdb (Allow sending log messages to a CouchDB
> server) monolog/monolog suggests installing ext-amqp (Allow sending
> log messages to an AMQP server (1.0+ required)) monolog/monolog
> suggests installing ext-mongo (Allow sending log messages to a MongoDB
> server) monolog/monolog suggests installing graylog2/gelf-php (Allow
> sending log messages to a GrayLog2 server) monolog/monolog suggests
> installing mongodb/mongodb (Allow sending log messages to a MongoDB
> server via PHP Driver) monolog/monolog suggests installing
> php-amqplib/php-amqplib (Allow sending log messages to an AMQP server
> using php-amqplib) monolog/monolog suggests installing
> php-console/php-console (Allow sending log messages to Google Chrome)
> monolog/monolog suggests installing rollbar/rollbar (Allow sending log
> messages to Rollbar) monolog/monolog suggests installing
> ruflin/elastica (Allow sending log messages to an Elastic Search
> server) monolog/monolog suggests installing sentry/sentry (Allow
> sending log messages to a Sentry server) Writing lock file Generating
> autoload files
test.php
require __DIR__ . '/vendor/autoload.php';
$client = new AdyenClient();
$client->setApplicationName("Adyen PHP Api Library Example");
$client->setUsername("xxxx");
$client->setPassword("xxxxx");
$client->setXApiKey("xxxxxxxxxxx");
$client->setEnvironment(AdyenEnvironment::TEST);
$service = new ServicePayment($client);
$json = '{
"card": {
"number": "4111111111111111",
"expiryMonth": "03",
"expiryYear": "2030",
"cvc": "737",
"holderName": "John Smith"
},
"amount": {
"value": 1500,
"currency": "EUR"
},
"reference": "payment-test",
"merchantAccount": "ourshopcom"
}';
$params = json_decode($json, true);
$result = $service->authorise($params);
php composer-php adyen
1
Did you try,AdyenServicePayment($client);
, if in doubt always check the file.
– Lawrence Cherone
Nov 10 at 14:53
......ah totally didn't look into the path
– alex
Nov 10 at 15:02
..but still no working code. I have edited the card expire date as stated in the docs. But still i get ' Fatal error: Uncaught exception 'AdyenAdyenException' with message 'Not allowed' '
– alex
Nov 10 at 16:12
Thats diff from the original issue, I suggest you look up on how to catch exceptions in PHP php.net/manual/en/language.exceptions.php andNot allowed
probably means your not allowed to issue the api call as its not a php error but a defined exception which you are meant to handle. The issue could be any of them variables in the json payload. YOUR MERCHANT ACCOUNT is obviously not correct.
– Lawrence Cherone
Nov 10 at 16:17
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to get the Adyen php-api-library working, but i get the message:
Fatal error: Class 'ServicePayment' not found
The error message makes me to believe the class payment is not being loaded, but how do i make sure / fix this?? I thought composer would do the job.
I am devolping on a local XAMPP (mac)
- i have installed with composer
- simple test.php
> composer require adyen/php-api-library Using version ^1.5 for
> adyen/php-api-library ./composer.json has been created Loading
> composer repositories with package information Updating dependencies
> (including require-dev) Package operations: 3 installs, 0 updates, 0
> removals
> - Installing psr/log (1.0.2): Loading from cache
> - Installing monolog/monolog (1.24.0): Downloading (100%)
> - Installing adyen/php-api-library (1.5.3): Downloading (100%) monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log
> messages to AWS services like DynamoDB) monolog/monolog suggests
> installing doctrine/couchdb (Allow sending log messages to a CouchDB
> server) monolog/monolog suggests installing ext-amqp (Allow sending
> log messages to an AMQP server (1.0+ required)) monolog/monolog
> suggests installing ext-mongo (Allow sending log messages to a MongoDB
> server) monolog/monolog suggests installing graylog2/gelf-php (Allow
> sending log messages to a GrayLog2 server) monolog/monolog suggests
> installing mongodb/mongodb (Allow sending log messages to a MongoDB
> server via PHP Driver) monolog/monolog suggests installing
> php-amqplib/php-amqplib (Allow sending log messages to an AMQP server
> using php-amqplib) monolog/monolog suggests installing
> php-console/php-console (Allow sending log messages to Google Chrome)
> monolog/monolog suggests installing rollbar/rollbar (Allow sending log
> messages to Rollbar) monolog/monolog suggests installing
> ruflin/elastica (Allow sending log messages to an Elastic Search
> server) monolog/monolog suggests installing sentry/sentry (Allow
> sending log messages to a Sentry server) Writing lock file Generating
> autoload files
test.php
require __DIR__ . '/vendor/autoload.php';
$client = new AdyenClient();
$client->setApplicationName("Adyen PHP Api Library Example");
$client->setUsername("xxxx");
$client->setPassword("xxxxx");
$client->setXApiKey("xxxxxxxxxxx");
$client->setEnvironment(AdyenEnvironment::TEST);
$service = new ServicePayment($client);
$json = '{
"card": {
"number": "4111111111111111",
"expiryMonth": "03",
"expiryYear": "2030",
"cvc": "737",
"holderName": "John Smith"
},
"amount": {
"value": 1500,
"currency": "EUR"
},
"reference": "payment-test",
"merchantAccount": "ourshopcom"
}';
$params = json_decode($json, true);
$result = $service->authorise($params);
php composer-php adyen
I am trying to get the Adyen php-api-library working, but i get the message:
Fatal error: Class 'ServicePayment' not found
The error message makes me to believe the class payment is not being loaded, but how do i make sure / fix this?? I thought composer would do the job.
I am devolping on a local XAMPP (mac)
- i have installed with composer
- simple test.php
> composer require adyen/php-api-library Using version ^1.5 for
> adyen/php-api-library ./composer.json has been created Loading
> composer repositories with package information Updating dependencies
> (including require-dev) Package operations: 3 installs, 0 updates, 0
> removals
> - Installing psr/log (1.0.2): Loading from cache
> - Installing monolog/monolog (1.24.0): Downloading (100%)
> - Installing adyen/php-api-library (1.5.3): Downloading (100%) monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log
> messages to AWS services like DynamoDB) monolog/monolog suggests
> installing doctrine/couchdb (Allow sending log messages to a CouchDB
> server) monolog/monolog suggests installing ext-amqp (Allow sending
> log messages to an AMQP server (1.0+ required)) monolog/monolog
> suggests installing ext-mongo (Allow sending log messages to a MongoDB
> server) monolog/monolog suggests installing graylog2/gelf-php (Allow
> sending log messages to a GrayLog2 server) monolog/monolog suggests
> installing mongodb/mongodb (Allow sending log messages to a MongoDB
> server via PHP Driver) monolog/monolog suggests installing
> php-amqplib/php-amqplib (Allow sending log messages to an AMQP server
> using php-amqplib) monolog/monolog suggests installing
> php-console/php-console (Allow sending log messages to Google Chrome)
> monolog/monolog suggests installing rollbar/rollbar (Allow sending log
> messages to Rollbar) monolog/monolog suggests installing
> ruflin/elastica (Allow sending log messages to an Elastic Search
> server) monolog/monolog suggests installing sentry/sentry (Allow
> sending log messages to a Sentry server) Writing lock file Generating
> autoload files
test.php
require __DIR__ . '/vendor/autoload.php';
$client = new AdyenClient();
$client->setApplicationName("Adyen PHP Api Library Example");
$client->setUsername("xxxx");
$client->setPassword("xxxxx");
$client->setXApiKey("xxxxxxxxxxx");
$client->setEnvironment(AdyenEnvironment::TEST);
$service = new ServicePayment($client);
$json = '{
"card": {
"number": "4111111111111111",
"expiryMonth": "03",
"expiryYear": "2030",
"cvc": "737",
"holderName": "John Smith"
},
"amount": {
"value": 1500,
"currency": "EUR"
},
"reference": "payment-test",
"merchantAccount": "ourshopcom"
}';
$params = json_decode($json, true);
$result = $service->authorise($params);
php composer-php adyen
php composer-php adyen
edited Nov 11 at 7:41
asked Nov 10 at 14:49
alex
1,848103661
1,848103661
1
Did you try,AdyenServicePayment($client);
, if in doubt always check the file.
– Lawrence Cherone
Nov 10 at 14:53
......ah totally didn't look into the path
– alex
Nov 10 at 15:02
..but still no working code. I have edited the card expire date as stated in the docs. But still i get ' Fatal error: Uncaught exception 'AdyenAdyenException' with message 'Not allowed' '
– alex
Nov 10 at 16:12
Thats diff from the original issue, I suggest you look up on how to catch exceptions in PHP php.net/manual/en/language.exceptions.php andNot allowed
probably means your not allowed to issue the api call as its not a php error but a defined exception which you are meant to handle. The issue could be any of them variables in the json payload. YOUR MERCHANT ACCOUNT is obviously not correct.
– Lawrence Cherone
Nov 10 at 16:17
add a comment |
1
Did you try,AdyenServicePayment($client);
, if in doubt always check the file.
– Lawrence Cherone
Nov 10 at 14:53
......ah totally didn't look into the path
– alex
Nov 10 at 15:02
..but still no working code. I have edited the card expire date as stated in the docs. But still i get ' Fatal error: Uncaught exception 'AdyenAdyenException' with message 'Not allowed' '
– alex
Nov 10 at 16:12
Thats diff from the original issue, I suggest you look up on how to catch exceptions in PHP php.net/manual/en/language.exceptions.php andNot allowed
probably means your not allowed to issue the api call as its not a php error but a defined exception which you are meant to handle. The issue could be any of them variables in the json payload. YOUR MERCHANT ACCOUNT is obviously not correct.
– Lawrence Cherone
Nov 10 at 16:17
1
1
Did you try,
AdyenServicePayment($client);
, if in doubt always check the file.– Lawrence Cherone
Nov 10 at 14:53
Did you try,
AdyenServicePayment($client);
, if in doubt always check the file.– Lawrence Cherone
Nov 10 at 14:53
......ah totally didn't look into the path
– alex
Nov 10 at 15:02
......ah totally didn't look into the path
– alex
Nov 10 at 15:02
..but still no working code. I have edited the card expire date as stated in the docs. But still i get ' Fatal error: Uncaught exception 'AdyenAdyenException' with message 'Not allowed' '
– alex
Nov 10 at 16:12
..but still no working code. I have edited the card expire date as stated in the docs. But still i get ' Fatal error: Uncaught exception 'AdyenAdyenException' with message 'Not allowed' '
– alex
Nov 10 at 16:12
Thats diff from the original issue, I suggest you look up on how to catch exceptions in PHP php.net/manual/en/language.exceptions.php and
Not allowed
probably means your not allowed to issue the api call as its not a php error but a defined exception which you are meant to handle. The issue could be any of them variables in the json payload. YOUR MERCHANT ACCOUNT is obviously not correct.– Lawrence Cherone
Nov 10 at 16:17
Thats diff from the original issue, I suggest you look up on how to catch exceptions in PHP php.net/manual/en/language.exceptions.php and
Not allowed
probably means your not allowed to issue the api call as its not a php error but a defined exception which you are meant to handle. The issue could be any of them variables in the json payload. YOUR MERCHANT ACCOUNT is obviously not correct.– Lawrence Cherone
Nov 10 at 16:17
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
The docs on the GitHub for that is wrong. I looked at the source.
That class is in namespace "AdyenService".
Change your code as follows:
$service = new AdyenServicePayment($client);
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
The docs on the GitHub for that is wrong. I looked at the source.
That class is in namespace "AdyenService".
Change your code as follows:
$service = new AdyenServicePayment($client);
add a comment |
up vote
1
down vote
accepted
The docs on the GitHub for that is wrong. I looked at the source.
That class is in namespace "AdyenService".
Change your code as follows:
$service = new AdyenServicePayment($client);
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
The docs on the GitHub for that is wrong. I looked at the source.
That class is in namespace "AdyenService".
Change your code as follows:
$service = new AdyenServicePayment($client);
The docs on the GitHub for that is wrong. I looked at the source.
That class is in namespace "AdyenService".
Change your code as follows:
$service = new AdyenServicePayment($client);
edited Nov 10 at 15:03
Funk Forty Niner
80.4k124799
80.4k124799
answered Nov 10 at 15:00
ryantxr
2,5671520
2,5671520
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53240096%2fclasses-dont-autoload-with-adyen-php-api-library%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Did you try,
AdyenServicePayment($client);
, if in doubt always check the file.– Lawrence Cherone
Nov 10 at 14:53
......ah totally didn't look into the path
– alex
Nov 10 at 15:02
..but still no working code. I have edited the card expire date as stated in the docs. But still i get ' Fatal error: Uncaught exception 'AdyenAdyenException' with message 'Not allowed' '
– alex
Nov 10 at 16:12
Thats diff from the original issue, I suggest you look up on how to catch exceptions in PHP php.net/manual/en/language.exceptions.php and
Not allowed
probably means your not allowed to issue the api call as its not a php error but a defined exception which you are meant to handle. The issue could be any of them variables in the json payload. YOUR MERCHANT ACCOUNT is obviously not correct.– Lawrence Cherone
Nov 10 at 16:17