Skip to main content
Published: August 08 2011, 3:57:00 PMUpdated: November 28 2020, 9:58:28 PM

GetOrders - How can i retreive the Orders that are paid and ready for shipment? (PHP Sample code)

You need to write your business logic in a way that it performs a check for new orders with a paid Time and ExternalTransactionID , with  shipped time field's existence.
Shipped Time is the Timestamp indicating the date and time of order shipment. This field is not returned until the order has been marked as shipped.

Consider the Example code snippet Below.(Assuming that you are already using the GetOrders PHP sample to reteive the XML response and were able to parse the xml fields as shown in the sample : https://ebaydts.com/eBayKBDetails?KBid=1876)

$orderArray = $response->OrderArray;

 

foreach($orderArray as $order)

{

$paidTime = $order->PaidTime;

$shippedTime = $order->ShippedTime;

if($PaidTime != "" )// check if the order is paid, paid time will not be returned until payment has been made and checkout is complete.

{

if($shippedTime == ""){

//Order was paid but not shipped,

echo "The order with OrderNumber : " . $order->OrderID . " was paid but not shipped yet !";

}else{//paid time and shipped time not null.

echo "The order with OrderNumber : " . $order->OrderID . " was Paid and Shipped !";

}

}else {//PaidTime = null

echo "The order with OrderNumber : " . $order->OrderID . " was not Paid yet !";

}
}

How well did this answer your question?
Answers others found helpful