Marketplace::Ebay - Making API calls to eBay (with XSD validation)


Version 0.200


  my $ebay = Marketplace::Ebay->new(
                                    production => 0,
                                    site_id => 77,
                                    developer_key => '1234',
                                    application_key => '6789',
                                    certificate_key => '6666',
                                    token => 'asd12348',
                                    xsd_file => 'ebay.xsd',
  my $res = $ebay->api_call('GeteBayOfficialTime', {});
  print Dumper($res);


International Selling

Products propagate from your local selling account to all Ebay sites where you are going to ship your items to:



The following are required for a successful API call.






The id of the site. E.g., Germany is 77.


Path to the XSD file with the eBay definitions.


Boolean. Default to false.

By default, the API calls are done against the sandbox. Set it to true in production.


Set lazily by the class depending on the production value.


The version of API and XSD used. Please keep this in sync with the XSD.


You can get the HTTP::Response object of the last call using this accessor.


You can get the HTTP::Request object of the last call using this accessor.


Return a Marketplace::Ebay::Response object (or undef on failure) out of the return value of the last api_call.


A filename where to log requests and responses.


Passed to Marketplace::Ebay::Order. Defaults to true.


api_call($name, \%data, \%options)

Do the API call $name with payload in %data. Return the data structure of the Marketplace::Ebay::Response object. In case of failure, return nothing. In this case, you can inspect the details of the failure inspecting, e.g.,


With option requires_struct set to a true value, the method doesn't return the object, but a plain hashref with the structure returned (old behaviour).

With an option no_validate, the XML is parsed using XMLin, not the schema, so the result could be unstable, but on the other hand, you get something out of XML which doesn't comply with the schema.

prepare_xml($name, \%data)

Create the XML document to send for the API call $name.

show_xml_template($call, $call_type)

Utility for development. Show the expected structure for the API call $call. The second argument is optional, and may be Request or Response, defaulting to Request.


Append the arguments to the log_file, if it was defined.


api_call_wrapper($call, $data, @ids)

Call Ebay's API $call with data $data. Then check the response and return it. This ends calling $self->api_call($call, $data), but after that the response is checked and diagnostics are printed out. If you want something quiet and which is not going to die, or you're expecting invalid structures, you should use api_call directly.

Return the response object. If no response object is found, it will die.

api_call_wrapper_silent($call, $data, @ids)

Same as api_call_wrapper, but do not emit "warn" on warnings. Just print them out. Also, do not print ids or fees.

cancel_item($identifier, $id, $reason)

$identifier is mandatory and can be SKU or ItemID (depending if you do tracking by sku (this is possible only if the sku was uploaded with InventoryTrackingMethod = SKU) or by ebay item id. The $id is mandatory and is the sku or the ebay_id.

Reason can be one of the following, defaulting to OtherListingError: Incorrect, LostOrBroken, NotAvailable, OtherListingError, SellToHighBidder, Sold.

It calls EndFixedPriceItem, so this method is useful only for shops.

delete_sku_variations($sku, \@list_of_sku_variations)

It uses ReviseFixedPriceItem to cancel variations of a given sku, not passing asking for a deletion, but instead setting the quantity to 0. This because deleting a variation is not possible if a purchase has been done against it.


Return a dump of the structure found in the GetCategorySpecifics


Retrieve the last orders in the last number of days, defaulting to 7. Return a list of Marketplace::Ebay::Order objects. You can access the raw structures with $object->order.


Like get_orders, but filter the orders by the site_id of the object (otherwise you pull the orders from all the international sites).

ebay_site_code_types (internal) turned into an hashref to map the site name to an id.


Return an hashref for mapping ebay site names and abbreviations to a numeric id.


Return an hashref for mapping ebay site id to its name. #


Marco Pessotto, <melmothx at>


Please report any bugs or feature requests to bug-marketplace-ebay at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc Marketplace::Ebay

You can also look for information at:



Copyright 2014 Marco Pessotto.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See for more information.