Reputation: 121
I have implemented PHP SDK for amazon pay and currently I am facing one error, When I click on amazon pay button then one popup will be open for asking login credentials for amazon and after logged in successfully then it will redirect to Address book and payment methods choose page and on that page I am facing this error and Json response that I am getting are as below.
AmazonPay\ResponseParser Object
(
[response] => Array
(
[Status] => 401
[ResponseBody] =>
Sender
AccessDenied
Access denied
11e659e5-6413-4f49-ab38-339472490e5c
)
)
{
"Error": {
"Type": "Sender",
"Code": "AccessDenied",
"Message": "Access denied"
},
"RequestID": "11e659e5-6413-4f49-ab38-339472490e5c",
"ResponseStatus": "401"
}
So please suggest to me if you are aware of this error. Thanks in advance!
Upvotes: 3
Views: 830
Reputation: 13
Please, you need to set proper country config settings on amazon pay configuration file. for example, If you select Region is UK and Currency is GBP while registration on seller-central account then you have to set 'region' => 'uk' and 'currency'=> 'GBP' in amazon pay configuration file. if you add different region or currency details then you will get Access Denied error.
please..follow below code
<?php
namespace AmazonPay;
$config = array(
'merchant_id' => 'YOUR_MERCHANT_ID',
'access_key' => 'YOUR_ACCESS_KEY',
'secret_key' => 'YOUR_SECRET_KEY',
'client_id' => 'YOUR_LOGIN_WITH_AMAZON_CLIENT_ID',
'region' => 'uk', //set value here
'currency_code' => 'GBP' //set value here
'sandbox' => true);
$client = new Client($config);
Upvotes: 1
Reputation: 834
Please set proper country wise config settings on amazon pay configuration file. i.e If your country select UK based then amazon pay sandbox work with GBP and UK only and if you try with another region or currency then you will get this Access Denied error.
Also cross check Amazon Sandbox credentials with that you have set in your file and make sure all settings will be correct.
<?php
namespace AmazonPay;
$config = array(
'merchant_id' => 'YOUR_MERCHANT_ID',
'access_key' => 'YOUR_ACCESS_KEY',
'secret_key' => 'YOUR_SECRET_KEY',
'client_id' => 'YOUR_LOGIN_WITH_AMAZON_CLIENT_ID',
'region' => 'REGION',
'sandbox' => true);
$client = new Client($config);
// Also you can set the sandbox variable in the config() array of the Client class by
$client->setSandbox(true);
Click here to see full documentation for implement amazon pay payment gateway in your website.
Upvotes: 2