keithbrink/amazon-mws-laravel

MalformedInput error when get orders list from Amazon

alisanalacam opened this issue · 10 comments

Hi,
I can get Amazon Feed Status but
I want to get orders list from Amazon but i am getting an error.

My post query:

SellerId=A1**&
MarketplaceId=A2**&
AWSAccessKeyId=AK***&
MWSAuthToken=amzn.mws.fcb***&
SignatureVersion=2&
SignatureMethod=HmacSHA256&
Version=2013-09-01&
MarketplaceId.Id.1=A2**&
LastUpdatedAfter=2020-04-29T15%3A30%3A02%2B00%3A00&
LastUpdatedBefore=2020-04-30T15%3A28%3A02%2B00%3A00&
FulfillmentChannel.Channel.1=MFN&
OrderStatus.Status.1=Shipped&
Action=ListOrders&
Timestamp=2020-04-30T15%3A30%3A02%2B00%3A00&
Signature=123**

My code is :

$amz = new AmazonOrderList("store1"); //store name matches the array key in the config file
$amz->setConfig($config);
$amz->setLimits('Modified', "- 90 days"); //accepts either specific timestamps or relative times
$amz->setFulfillmentChannelFilter("MFN"); //no Amazon-fulfilled orders
$amz->setOrderStatusFilter(
      array("Shipped")
); //no shipped or pending orders
$amz->setUseToken(); //tells the object to automatically use tokens right away
$amz->fetchOrders(); //this is what actually sends the request
return $amz->getList();

Response

<ErrorResponse xmlns="https://mws.amazonservices.com/Orders/2013-09-01">
      <Error>
        <Type>Sender</Type>
        <Code>MalformedInput</Code>
        <Message>Start of list found where not expected</Message>
      </Error>
      <RequestId>fef55b3f-90f8-464b-a1f8-70312c3ca160</RequestId>
</ErrorResponse>

what could be the cause of this problem?

What is the data in the $config variable?

Oh sorry

$config = [
            'merchantId' => 'A**', 
            'marketplaceId' => 'A2***',
            'keyId' => 'AKIA****',
            'secretKey' => 'jl***',
            'mwsAuthToken' => 'amzn.mws.fcb***',
            'amazonServiceUrl' => 'https://mws.amazonservices.ae/',
        ];

Can you try your request on the scratchpad and let me know if it goes through: https://mws.amazonservices.com/scratchpad/index.html

I applied the same request there. worked there. I had order list response

my post payload is :

SellerId=A17***&MarketplaceId=A2V***&AWSAccessKeyId=AKI***&MWSAuthToken=amzn.mws.fcb7***&SignatureVersion=2&SignatureMethod=HmacSHA256&Version=2013-09-01&MarketplaceId.Id.1=A2V***&LastUpdatedAfter=2020-05-03T09%3A18%3A38%2B00%3A00&LastUpdatedBefore=2020-05-04T09%3A16%3A38%2B00%3A00&FulfillmentChannel.Channel.1=MFN&OrderStatus.Status.1=Shipped&Action=ListOrders&Timestamp=2020-05-04T09%3A18%3A38%2B00%3A00&Signature=Q6a***hvjhM%3D

same issues here -working well on scratchpad.

I believe this issue has been resolved in version 7.1.0.

funny, i was just about to suggest this fix :) found it as well.

hey again, sorry to bother you but the applied fix not really works. i had to move it from setConfig to the __construct to get it done.

You're right, that's my bad as I was using a dynamic config to test. Moved it to the constructor in 7.1.1