亚马逊 MWS - 卡在 GetMyFeesEstimate (PHP/Laravel)
Amazon MWS - Stuck with GetMyFeesEstimate (PHP/Laravel)
我正在使用以下亚马逊 MWS 软件包用于 Laravel 项目 (https://packagist.org/packages/mcs/amazon-mws)。它工作得很好,但缺少我需要的一种关键方法,GetMyFeesEstimate。
现在,我尝试自己扩展代码:
在 MWSEndPoint.php 中,我输入了:
'GetMyFeesEstimate'=> [
'method' => 'POST',
'action' => 'GetMyFeesEstimate',
'path' => '/Products/2011-10-01',
'date' => '2011-10-01'
],
在 MWSClient.php 中,我尝试了以下方法:
public function GetMyFeesEstimate($type, $idvalue, $price, $fba)
{
$array = [
'MarketplaceId' => $this->config['Marketplace_Id']
];
$feesEstimateRequest = [
'IdType' => $type,
'IdValue' => $idvalue,
'PriceToEstimateFees' => array('ListingPrice'=>array('Amount',floatval($price))),
'Identifier' => null,
'IsAmazonFulfilled' => $fba
];
$array['FeesEstimateRequestList'] = array($feesEstimateRequest);
$response = $this->request(
'GetMyFeesEstimate',
$array
);
dd($response);
}
但是,我收到以下错误,我不确定哪里出错了:
"The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details."
我已经玩了几个小时,广泛查看了文档:
http://docs.developer.amazonservices.com/en_US/products/Products_GetMyFeesEstimate.html
http://docs.developer.amazonservices.com/en_US/products/Products_Datatypes.html#FeesEstimateRequest
...但没有成功。有人可以帮我解决这个问题吗?
好吧,我仔细查看了文档并提出了这个(有效):
public function GetMyFeesEstimate($idtype, $idvalue, $price, $currency, $fba)
{
$query = [
'MarketplaceId' => $this->config['Marketplace_Id']
];
$query['FeesEstimateRequestList.FeesEstimateRequest.1.MarketplaceId'] = $this->config['Marketplace_Id'];
$query['FeesEstimateRequestList.FeesEstimateRequest.1.IdType'] = $idtype;
$query['FeesEstimateRequestList.FeesEstimateRequest.1.IdValue'] = $idvalue;
$query['FeesEstimateRequestList.FeesEstimateRequest.1.PriceToEstimateFees.ListingPrice.Amount'] = floatval($price);
$query['FeesEstimateRequestList.FeesEstimateRequest.1.PriceToEstimateFees.ListingPrice.CurrencyCode'] = $currency;
$query['FeesEstimateRequestList.FeesEstimateRequest.1.Identifier'] = gmdate(self::DATE_FORMAT, time());
$query['FeesEstimateRequestList.FeesEstimateRequest.1.IsAmazonFulfilled'] = $fba;
$response = $this->request(
'GetMyFeesEstimate',
$query
);
return $response;
}
我正在使用以下亚马逊 MWS 软件包用于 Laravel 项目 (https://packagist.org/packages/mcs/amazon-mws)。它工作得很好,但缺少我需要的一种关键方法,GetMyFeesEstimate。
现在,我尝试自己扩展代码: 在 MWSEndPoint.php 中,我输入了:
'GetMyFeesEstimate'=> [
'method' => 'POST',
'action' => 'GetMyFeesEstimate',
'path' => '/Products/2011-10-01',
'date' => '2011-10-01'
],
在 MWSClient.php 中,我尝试了以下方法:
public function GetMyFeesEstimate($type, $idvalue, $price, $fba)
{
$array = [
'MarketplaceId' => $this->config['Marketplace_Id']
];
$feesEstimateRequest = [
'IdType' => $type,
'IdValue' => $idvalue,
'PriceToEstimateFees' => array('ListingPrice'=>array('Amount',floatval($price))),
'Identifier' => null,
'IsAmazonFulfilled' => $fba
];
$array['FeesEstimateRequestList'] = array($feesEstimateRequest);
$response = $this->request(
'GetMyFeesEstimate',
$array
);
dd($response);
}
但是,我收到以下错误,我不确定哪里出错了: "The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details."
我已经玩了几个小时,广泛查看了文档: http://docs.developer.amazonservices.com/en_US/products/Products_GetMyFeesEstimate.html http://docs.developer.amazonservices.com/en_US/products/Products_Datatypes.html#FeesEstimateRequest
...但没有成功。有人可以帮我解决这个问题吗?
好吧,我仔细查看了文档并提出了这个(有效):
public function GetMyFeesEstimate($idtype, $idvalue, $price, $currency, $fba)
{
$query = [
'MarketplaceId' => $this->config['Marketplace_Id']
];
$query['FeesEstimateRequestList.FeesEstimateRequest.1.MarketplaceId'] = $this->config['Marketplace_Id'];
$query['FeesEstimateRequestList.FeesEstimateRequest.1.IdType'] = $idtype;
$query['FeesEstimateRequestList.FeesEstimateRequest.1.IdValue'] = $idvalue;
$query['FeesEstimateRequestList.FeesEstimateRequest.1.PriceToEstimateFees.ListingPrice.Amount'] = floatval($price);
$query['FeesEstimateRequestList.FeesEstimateRequest.1.PriceToEstimateFees.ListingPrice.CurrencyCode'] = $currency;
$query['FeesEstimateRequestList.FeesEstimateRequest.1.Identifier'] = gmdate(self::DATE_FORMAT, time());
$query['FeesEstimateRequestList.FeesEstimateRequest.1.IsAmazonFulfilled'] = $fba;
$response = $this->request(
'GetMyFeesEstimate',
$query
);
return $response;
}