2

花了无数时间挖掘 eBay API 文档,却找不到任何东西。

在卖家账户上,我需要获取状态为“等待邮资”​​或“未发货”的所有订单的列表。因此,我可以获得当前“未发货”的所有订单的 XML 报告,其中包含有关客户的完整详细信息(送货地址、使用的邮资方式等)

GetOrders不提供未发货订单的过滤器。
GetSellingManagerSoldListings具有此类功能,但不提供有关客户运输详细信息的任何详细信息。

有人遇到过这样的问题吗?

提前致谢。

4

6 回答 6

3

GetOrders 不为 Unshipped 订单提供过滤器..但是如果有 [ShippedTime] 的对象响应您的 GetOrders 请求,这意味着订单是为未发货的物品发货的,您将不会得到 [ShippedTime] 的对象...在此基地可以查询未发货订单

于 2013-12-12T14:05:55.543 回答
0

这段代码对我有用,希望你觉得它有用

 date_default_timezone_set('Europe/London');
 $page = 0;
 $order_count = 0;
 $shipped_count = 0;
 do
 {
     $page++;


    $feed = <<< EOD
<?xml version="1.0" encoding="utf-8"?>
<GetOrdersRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<RequesterCredentials>
<eBayAuthToken>$auth_token</eBayAuthToken>
</RequesterCredentials>
<OrderRole>Seller</OrderRole>
<OrderStatus>Completed</OrderStatus>
<Pagination>
<EntriesPerPage>100</EntriesPerPage>
<PageNumber>$page</PageNumber>
</Pagination>
<NumberOfDays>7</NumberOfDays>
<ErrorLanguage>en_GB</ErrorLanguage>
<Version>823</Version>
<WarningLevel>High</WarningLevel>
</GetOrdersRequest>?
EOD;

$feed = trim($feed);
     $site_id = 3;//3 For UK
     $call_name = 'GetOrders';
     $headers = array
         (
         'X-EBAY-API-COMPATIBILITY-LEVEL: ' . $compat_level,
         'X-EBAY-API-DEV-NAME: ' . $dev_id,
         'X-EBAY-API-APP-NAME: ' . $app_id,
         'X-EBAY-API-CERT-NAME: ' . $cert_id,
         'X-EBAY-API-CALL-NAME: ' . $call_name,
         'X-EBAY-API-SITEID: ' . $site_id,
     );

     // Send request to eBay and load response in $response
     $connection = curl_init();
     curl_setopt($connection, CURLOPT_URL, $api_endpoint);
     curl_setopt($connection, CURLOPT_SSL_VERIFYPEER, 0);
     curl_setopt($connection, CURLOPT_SSL_VERIFYHOST, 0);
     curl_setopt($connection, CURLOPT_HTTPHEADER, $headers);
     curl_setopt($connection, CURLOPT_POST, 1);
     curl_setopt($connection, CURLOPT_POSTFIELDS, $feed);
     curl_setopt($connection, CURLOPT_RETURNTRANSFER, 1);
     $response = curl_exec($connection);
     curl_close($connection);

     $order_count += substr_count($response, "<Order>");
     $shipped_count += substr_count($response, "<ShippedTime>");
 }
 while(stristr($response, "<HasMoreOrders>true</HasMoreOrders>") != FALSE OR stristr($response, "<HasMoreOrders>true</HasMoreOrders>") != 0);
 $unshipped_orders = $order_count - $shipped_count;
于 2013-06-07T09:39:36.960 回答
0

好吧,我通过使用 php 的参数得到了要发货的订单。

$xmlReq = '<?xml version="1.0" encoding="utf-8"?>';
$xmlReq .= '<GetSellingManagerSoldListingsRequest xmlns="urn:ebay:apis:eBLBaseComponents">';
$xmlReq .= '<UserID>'.$YOUR_EBAY_APP_ID.'</UserID>';
$xmlReq .= '<Filter>PaidNotShipped</Filter>';
$xmlReq .= '<Pagination><EntriesPerPage>200</EntriesPerPage><PageNumber>1</PageNumber></Pagination>';
$xmlReq .= '<ErrorLanguage>en_US</ErrorLanguage>';
$xmlReq .= "<Version>$version</Version>";
$xmlReq .= '<WarningLevel>Low</WarningLevel>';
$xmlReq .= "<RequesterCredentials><eBayAuthToken>$YOUR_AUTH_TOKEN</eBayAuthToken></RequesterCredentials>\n";    
$xmlReq .= '</GetSellingManagerSoldListingsRequest>';

我希望你得到了过滤参数“PaidNoTShipped”。您将在此响应中获得一个 order_line_item_id 并使用它只需使用此订单行项目 ID GetOrderTransactions 再次调用,您将获得其余信息。在 GetOrderTransactions 中使用<DetailLevel>ReturnAll</DetailLevel>以获得扩展结果。如果您想了解更多有关 api 调用的信息,请告诉我。

于 2016-12-28T12:45:12.090 回答
0

GetOrders 有RequiredSellerAction标签,显示卖家必须采取的下一步行动。

对于未发货的订单,它是 ' MarkAsShipped'

<PaymentHoldDetails>
<ExpectedReleaseDate>2018-04-20T07:00:00.000Z</ExpectedReleaseDate>
<RequiredSellerActionArray>
<RequiredSellerAction>MarkAsShipped</RequiredSellerAction>
</RequiredSellerActionArray>
<NumOfReqSellerActions>1</NumOfReqSellerActions>
<PaymentHoldReason>CasualSeller on https://www.aihello.com </PaymentHoldReason>
</PaymentHoldDetails>
于 2018-04-14T21:49:33.863 回答
0

在相当长的一段时间内,我一直在寻找这个问题的解决方案。这是一个非常古老的问题,但我希望它有一个更直接的答案。会为我节省几个小时。@Moazam 有正确的想法,但确实缺乏特异性,所以就这样吧。以下答案是用 python 编写的,基于/使用eBay 的 Api。(你会认为这会容易找到/做)

from ebaysdk.trading import Connection as Trading
from ebaysdk.exception import ConnectionError
import bs4 as bs # beautifulsoup import for parsing xml

try:
    api = Trading(config_file="ebay.yaml") #put ur eBay dev API credentials in yaml file
    response = api.execute('GetSellerTransactions', {}) # dictionary response
    dommy = response.content 

except ConnectionError as e: # spit error if can't connect (ie: wrong api credz)
    print(e)
    print(e.response.dict())

soup = bs.BeautifulSoup(dommy, 'lxml') # parse the API response as xml
tArray = soup.transactionarray 

with open('fullSoldLogXML.xml', 'w+') as xml: # Log file, not required.
    xml.write(str(soup)) # write entire ebay response to log file.

with open('singleTransactions.xml', 'w+') as tranXml: # Another log. Personal reference.
    tranXml.write(str(tArray)) # parse all transactions from transactionarray in xml 

for each in tArray: # tArray is every transaction, in transactionarray)
    print each.shippedtime # print shipped time, if None then hasn't been shipped.

应该输出如下内容:

<shippedtime>2016-12-18T15:12:22.000Z</shippedtime>
<shippedtime>2016-12-20T00:35:43.000Z</shippedtime>
<shippedtime>2016-12-20T01:50:37.000Z</shippedtime>
None

有了这些信息,您可以try/except对每个事务进行循环。If shippedtime == None,然后您可以剖析订单并获取有用的信息,例如print each.shippingaddress, each.orderlineitemid, each.paidtime等...

于 2016-12-20T20:29:48.087 回答
0

这是我的“hacky”方式:

try
{
$ShippedTime = $order->ShippedTime;
if($ShippedTime && isset($ShippedTime))
$ShippedTime = $ShippedTime->format('d-m-Y H:i:s');
else
$ShippedTime = 'awaiting dispatch'; 
}
catch(Exception $e)
{
 $ShippedTime = 'awaiting dispatch'; 
}
于 2019-03-04T14:33:00.887 回答