我是使用FBA的亚马逊卖家。我开始玩MWS。
第一个问题是:
亚马逊/所有订单"报告/履行的最佳(订单或报告)#34;和报告/付款/日期范围报告"
第二
我为" ORDERS"下载了PHP库。从 https://developer.amazonservices.co.uk/gp/mws/api.html?ie=UTF8&group=orders§ion=orders&version=latest
......当然还有问题
在config.inc.php中的我设置了所有数据并另外:
//set_include_path(get_include_path() . PATH_SEPARATOR . '../../.');
$path = 'http://MYWEBSITE/amazon-mws/';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
我测试文件" ListOrdersSample1"
<?php
/**
* List Orders Sample
*/
require_once('.config.inc.php');
/************************************************************************
* Instantiate Implementation of MarketplaceWebServiceOrders
*
* AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY constants
* are defined in the .config.inc.php located in the same
* directory as this sample
***********************************************************************/
// More endpoints are listed in the MWS Developer Guide
// North America:
//$serviceUrl = "https://mws.amazonservices.com/Orders/2013-09-01";
// Europe
$serviceUrl = "https://mws-eu.amazonservices.com/Orders/2013-09-01";
// Japan
//$serviceUrl = "https://mws.amazonservices.jp/Orders/2013-09-01";
// China
//$serviceUrl = "https://mws.amazonservices.com.cn/Orders/2013-09-01";
$config = array (
'ServiceURL' => $serviceUrl,
'ProxyHost' => null,
'ProxyPort' => -1,
'ProxyUsername' => null,
'ProxyPassword' => null,
'MaxErrorRetry' => 3,
);
$service = new MarketplaceWebServiceOrders_Client(
AWS_ACCESS_KEY_ID,
AWS_SECRET_ACCESS_KEY,
APPLICATION_NAME,
APPLICATION_VERSION,
$config);
/************************************************************************
* Uncomment to try out Mock Service that simulates MarketplaceWebServiceOrders
* responses without calling MarketplaceWebServiceOrders service.
*
* Responses are loaded from local XML files. You can tweak XML files to
* experiment with various outputs during development
*
* XML files available under MarketplaceWebServiceOrders/Mock tree
*
***********************************************************************/
$service = new MarketplaceWebServiceOrders_Mock();
/************************************************************************
* Setup request parameters and uncomment invoke to try out
* sample for List Orders Action
***********************************************************************/
// @TODO: set request. Action can be passed as MarketplaceWebServiceOrders_Model_ListOrders
$request = new MarketplaceWebServiceOrders_Model_ListOrdersRequest();
$request->setSellerId(MERCHANT_ID);
// object or array of parameters
invokeListOrders($service, $request);
/**
* Get List Orders Action Sample
* Gets competitive pricing and related information for a product identified by
* the MarketplaceId and ASIN.
*
* @param MarketplaceWebServiceOrders_Interface $service instance of MarketplaceWebServiceOrders_Interface
* @param mixed $request MarketplaceWebServiceOrders_Model_ListOrders or array of parameters
*/
function invokeListOrders(MarketplaceWebServiceOrders_Interface $service, $request)
{
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");
}
}
我尝试用于测试
$service = new MarketplaceWebServiceOrders_Mock();
但没有任何反应。 配置中的路径是否正确? 我不明白这个
$serviceUrl = "https://mws-eu.amazonservices.com/Orders/2013-09-01";
我应该更改日期吗?
我需要一些小工作的例子来开始。
非常感谢
答案 0 :(得分:1)
这取决于您要完成的任务。我认为Orders API是有益的,如果您需要对订单执行某些操作,例如自己发货(商家履行而不是FBA)。
如果您主要使用数据进行报告,则报告API会更有用。我使用的主要报告之一是_GET_AMAZON_FULFILLED_SHIPMENTS_DATA_
,因为它在实际发货后提供了销售数据。仅仅因为某人订购的东西并不意味着他们会真正得到这件物品。有时订单因信用卡被拒绝而失败,或者他们很快取消订单等等。
日期是您正在使用的API的版本。那将是2013-09-01。我强烈建议使用暂存器来查看针对每种请求返回的数据类型。它还有助于可视化您需要提供的参数类型。获得预期的结果。在编码之前我总是从这里开始。 https://mws.amazonservices.co.uk/scratchpad/index.html(将co.uk更改为您想要的任何内容,.de等)