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









share|improve this question




















  • 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

















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









share|improve this question




















  • 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















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









share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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
















  • 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










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














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





share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    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

























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





    share|improve this answer



























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





      share|improve this answer

























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





        share|improve this answer














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






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 10 at 15:03









        Funk Forty Niner

        80.4k124799




        80.4k124799










        answered Nov 10 at 15:00









        ryantxr

        2,5671520




        2,5671520






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Full-time equivalent

            Bicuculline

            さくらももこ