End Ebay Listing with the php function in functions.php, or use the EbayConnection.php class for an object oriented approach. EbayConnection.php also has the added functionality of saving the last error message as an object property.
Requires the Ebay Authentication Token which can be generated through the Ebay Developer program. I've used this function in combination with a Paypal IPN script to automatically remove Ebay listings when the item sells on a website.