amzn/amazon-pay-sdk-php

Unable to post request, underlying exception of SSL certificate problem

isac1991 opened this issue · 2 comments

Hi,
I have integrated the login with the amazonPaymentButton like shown at https://amzn.github.io/amazon-pay-sdk-samples/simple.html

After the login is successfull it retrieves the parameters access_token, token_type, expires_in and scope

Now at first I want to simply get the userinfo back.
I try it that way:

$config = array(
    'merchant_id'	=> $amazonMerchantID,
    'access_key'   	=> $amazonAccessKey,
    'secret_key'   	=> $amazonSecretKey,
    'client_id'   	=> $amazonClientID,
    'region'   		=> 'de',
    'sandbox'   	=> true
);
				
$client = new Client($this->configParams);
// Also you can set the sandbox variable in the config() array of the Client class by
$client->setSandbox(true);
$userInfo 		= $client->getUserInfo($access_token);

But then I'm getting the following error:

Fatal error: Uncaught Exception: Unable to post request, underlying exception of SSL certificate problem: unable to get local issuer certificate in ...\includes\vendor\amzn\amazon-pay-sdk-php\AmazonPay\HttpCurl.php on line

I'm testing in my localhost. So I have no SSL.
But in the amazon documentation they said, that I don't need a https url when I'm develop at localhost.

So, what am I doing wrong?

It sounds like your PHP/curl installation is using an outdated certificate bundle. How you update the bundle depends on which version of PHP you are using and which OS you are using.

See the following link for a starting point as to what to try:
https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/faq.html#what-do-i-do-about-a-curl-ssl-certificate-error

This might help too:
https://docs.bolt.cm/3.5/howto/curl-ca-certificates

Let me know if any of that helps. If it doesn't, we can take this "offline", and I'll let you know how to contact us via official support channels through Seller Central.

Thank you!
After I downloaded the new cacert.pem and added the curl.cainfo in my php.ini it works fine and I'm getting the userInfo.

So I close this thread.