Here is the XML I’m calling into ebay. I get all completed items except for those completed without a payment (which I’ve read I should be getting back).
I’d much rather have a method that only calls “Awaiting Payment”, “Awaiting Shipping”, “Shipped”. If that is possible, I’m not aware of it from my research. I’m currently gathering all Completed for n days and filtering them out myself
Endpoint:
https://api.ebay.com/ws/api.dll
XML:
<?xml version='1.0' encoding='utf-8'?>
<GetOrdersRequest xmlns='urn:ebay:apis:eBLBaseComponents'>
<RequesterCredentials>
<eBayAuthToken>$requestToken</eBayAuthToken>
</RequesterCredentials>
<OrderRole>Seller</OrderRole>
<OrderStatus>Completed</OrderStatus>
<Pagination>
<EntriesPerPage>100</EntriesPerPage>
<PageNumber>$page</PageNumber>
</Pagination>
<NumberOfDays>7</NumberOfDays>
<ErrorLanguage>en_US</ErrorLanguage>
<Version>823</Version>
<WarningLevel>High</WarningLevel>
</GetOrdersRequest>
Logic on sorting out:
foreach($orderArray as $order)
{
$paidTime = (isset($order['PaidTime']) ? $order['PaidTime'] : '');
$shippedTime = (isset($order['ShippedTime']) ? $order['ShippedTime'] : '');
if($paidTime != "" ){
if($shippedTime == "")
array_push($itemPaidNotShipped,$order);
else
array_push($itemPaidShipped,$order);
}else{
array_push($itemNotPaidNotShipped,$order);
}
}
Edit after accepted Answer, here is my sorting logic:
foreach($orderArray as $order){
$paidTime = (isset($order['PaidTime']) ? $order['PaidTime'] : '');
$shippedTime = (isset($order['ShippedTime']) ? $order['ShippedTime'] : '');
$orderStatus = (isset($order['OrderStatus']) ? $order['OrderStatus'] : '');
if($orderStatus != "" && $orderStatus != 'Cancelled'){
if($paidTime != "" ){
if($shippedTime == "")
array_push($itemPaidNotShipped,$order);
else
array_push($itemPaidShipped,$order);
}else{
array_push($itemNotPaidNotShipped,$order);
}
}
}
2
Answers
There is no way to create a call that would only return a specific status like awaiting payment, awaiting shipment, or shipped that I have been able to find. It sounds like you are going in the right direction by gathering the past 7 days and then trying to determine paid status from there.
In order to determine paid status you need to check for PaidTime which can be an element in one of 2 places. The first is order (OrderArray.Order.PaidTime) and the second is transaction (OrderArray.Order.TransactionArray.Transaction.PaidTime). PaidTime is conditionally returned which means if it is not paid it will not be returned. If you parse for PaidTime and it is not present / not returned or is returned and there is no value present the item is considered not paid / awaiting payment. If there is a time present the payment has been received and would be considered paid.
I believe OrderStatus of Completed returns paid orders. You can leave out OrderStatus to receive all orders regardless of status or request Active to get unpaid orders.
If you are a Selling Manager Pro subscriber, you can use the GetSellingManagerSoldListings call
http://developer.ebay.com/Devzone/xml/docs/Reference/ebay/GetSellingManagerSoldListings.html
It has a filter field
You can find the values here
http://developer.ebay.com/Devzone/xml/docs/Reference/ebay/extra/GtSllngMngrSldLstngsRqst.Fltr.html
I use the GetOrders call; the GetSellingManagerSoldListings call includes the following:
Note: This call is subject to change without notice; the deprecation process is inapplicable to this call.