mollie / mollie-api-php

Mollie API client for PHP
http://www.mollie.com
BSD 2-Clause "Simplified" License
552 stars 191 forks source link

Getting 'Unauthorized request' #9

Closed ghost closed 9 years ago

ghost commented 9 years ago

I am trying to use the API but i always get this error..

My mollie.php

require_once dirname(__FILE__) . '/Mollie/API/Autoloader.php';

$mollie = new Mollie_API_Client;
$mollie->setApiKey('test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM'); // This is the test API?

$payments = $mollie->payments->all();

The message:

Fatal error: Uncaught exception 'Mollie_API_Exception' with message 'Error executing API call (request): Unauthorized request.' in /home/ibosadmin/domains/i-bos.nl/public_html/Mollie/API/Resource/Base.php:234

Stack trace:
#0 /home/ibosadmin/domains/i-bos.nl/public_html/Mollie/API/Resource/Base.php(114): Mollie_API_Resource_Base->performApiCall('GET', 'payments?offset...')
#1 /home/ibosadmin/domains/i-bos.nl/public_html/Mollie/API/Resource/Base.php(210): Mollie_API_Resource_Base->rest_list('payments', 0, 0)
#2 /home/ibosadmin/domains/i-bos.nl/public_html/mollie.php(20): Mollie_API_Resource_Base->all()
#3 {main} thrown in /home/ibosadmin/domains/i-bos.nl/public_html/Mollie/API/Resource/Base.php on line 234

Do i need to add something?

RickWong commented 9 years ago

Hi Youri! The example API key is just that: an example. To get your own test API key, first create a website profile in your Mollie account. Then click on its details to see the live and test API keys for that profile.

https://www.mollie.com/beheer/account/profielen/

ashishverma025 commented 6 years ago

I am trying to use the API but i always get this error.. API call failed: Error executing API call (request): Unauthorized request.

willemstuursma commented 6 years ago

@ashishverma025 Please review our documentation on Authenticating.

jimkaler commented 6 years ago

@ashishverma025 it may be because of your wrong API key, or you have not done proper setup in your mollie account settings.