亚马逊MWS ListOrders使用不同货币/时区的订单

时间:2016-05-09 08:17:48

标签: php amazon-web-services amazon-mws

我正在使用ListOrders api从亚马逊商店https://sellercentral.amazon.co.uk

获取订单

我已将时区设为欧洲/伦敦

但是listorders api缺少一些订单,这些订单的货币(欧元)不同,可能来自不同的国家(西班牙)。

所有带有货币英镑的订单都由api列出。我也尝试将时区改为欧洲/马德里,但这些订单仍未列出。 可能是什么原因?请帮忙。

由于

1 个答案:

答案 0 :(得分:0)

我刚刚将此方法添加到我的Amazon Orders API类中,它返回了100个订单,并且还给了我一个NextToken来访问下一个100或剩余订单。您只需要设置CreatedAfter日期和MarketPlaceID所有其他不是必填字段。

public function getOrderList()
    {
        $this->config['ServiceURL'] = "https://mws-eu.amazonservices.com/Orders/2013-09-01";
        $this->serviceURL = "https://mws-eu.amazonservices.com/Orders/2013-09-01";

        $service = new MarketplaceWebServiceOrders_Client($this->aws_access_key, $this->aws_secret_access_key, $this->application_name, $this->application_version, $this->config);

        $request = new \MarketplaceWebServiceOrders_Model_ListOrdersRequest();
        $request->setSellerId($this->seller_id);
        $request->setMarketplaceId($this->marketplace_id);
        $request->setCreatedAfter(date('Y-m-d\TH:i:s\Z', strtotime('-49 hours')));
        //new DateTime('-7 Days', new DateTimeZone('UTC'))


        try
        {
            $response = $service->ListOrders($request);

            echo ("Service Response\n");
            echo ("=============================================================================\n");

            $dom = new DOMDocument();
            $dom->loadXML($response->toXML());
            $dom->preserveWhiteSpace = false;
            $dom->formatOutput = true;
            echo $dom->saveXML();
            echo("ResponseHeaderMetadata: " . $response->getResponseHeaderMetadata() . "\n");
        }
        catch(MarketplaceWebServiceOrders_Exception $ex)
        {
            echo("Caught Exception: " . $ex->getMessage() . "\n");
            echo("Response Status Code: " . $ex->getStatusCode() . "\n");
            echo("Error Code: " . $ex->getErrorCode() . "\n");
            echo("Error Type: " . $ex->getErrorType() . "\n");
            echo("Request ID: " . $ex->getRequestId() . "\n");
            echo("XML: " . $ex->getXML() . "\n");
            echo("ResponseHeaderMetadata: " . $ex->getResponseHeaderMetadata() . "\n");
        }
    }