I have a few questions regarding the eBay API that I hope someone can answer, because I'm a bit stumped.
Is there a call or function that I can use to check whether or not a listing has sold or not? So say I have a product with a quantity of 1 that I wanted to list on eBay in addition to listing it on an online store I've built using Laravel. So say it sells first on eBay I'd like to be able to check that and remove it from the online store as well so that the product isn't "Oversold".
In no means and I'm asking someone to write a solution for me, I'm just asking to be pointed to the API call or in some sort of direction.
You can use the GetSingleItem
API.
I am using siteid=0
, which is US. You can change it to your corresponding siteid.
List of siteid's - http://developer.ebay.com/Devzone/merchandising/docs/Concepts/SiteIDToGlobalID.html
Code to check quantity sold:
$appid = 'YOUR_APP_ID';
$itemid = 'YOUR_ITEM_ID';
$siteid = 0; // US
$xml = simplexml_load_file('http://open.api.ebay.com/shopping?callname=GetSingleItem&responseencoding=XML&appid=' . $appid . '&siteid=' . $siteid . '&version=897&ItemID=' . $itemid . '&IncludeSelector=Details');
$ack = strtolower( (string) $xml->Ack );
if( $ack == 'success' ) {
echo "Total Quantity : " . (int)$xml->Item->Quantity . "<br />";
echo "Quantity Sold : " . (int)$xml->Item->QuantitySold . "<br />";
}
Hope this helps.