Package release

ocyan-plugin-ebay

mandel/stable · Version 0.1.2

eBay Trading API integration for Ocyan catalogue workflows

Metadata

author MandelBlogStack
description_content_type text/markdown
license Proprietary
provides_extras
  • test
requires_dist
  • django-oscar-invoices<0.4,>=0.3.1
  • ebaysdk<3,>=2.2
  • ocyan-core<2,>=1.2.14
  • ocyan-plugin-oscar-catalogue<3,>=2.0
  • ocyan-plugin-oscar-communications<3,>=2.0
  • ocyan-plugin-oscar-elasticsearch<3,>=2.1
  • ocyan-plugin-wagtail-oscar-integration<3,>=2.0
  • xmltodict<1,>=0.13
  • black; extra == 'test'
  • coverage; extra == 'test'
  • empty-testproject; extra == 'test'
  • freezegun; extra == 'test'
  • ocyan-plugin-testing; extra == 'test'
  • pylint-django; extra == 'test'
  • responses; extra == 'test'
requires_python <3.14,>=3.12

Release files

FileTest resultsHistory
ocyan_plugin_ebay-0.1.2-py3-none-any.whl
Size
112 KB
Type
Python Wheel
Python
3
ocyan_plugin_ebay-0.1.2.tar.gz
Size
95 KB
Type
Source

ocyan.plugin.ebay

MandelBlogStack contract

This optional backend integration synchronizes Oscar catalogue products and stock with eBay's Trading API. It owns eBay credentials/token persistence, listing and inventory sync queues, eBay category/item-specific data, order import, and the management commands that explicitly start those workflows. It does not own checkout, payments, search infrastructure, deployment, backups, or the MandelBlog frontend/theme system.

The data flow is deliberately asynchronous: product/stock changes create ListingSync/InventorySync records; a scheduled spooler consumes bounded batches and retries failed calls. eBay listing/order responses are translated back into the plugin's models and Oscar entities. Wagtail/Oscar integration and the certified search/catalogue packages remain dependencies, not duplicated implementations.

Configuration is supplied through the Ocyan ebay settings object (app/dev/ cert identifiers, redirect name, site/country, policy IDs, sandbox flag, refresh limits, and sync attributes). Sandbox is the default and synchronization is disabled by default. Tokens are stored in the database and must never be committed to source or fixtures. Consumers should use environment-backed Ocyan configuration and rotate eBay consent approximately yearly according to eBay's authorization policy.

Supported certification matrix: Python 3.12–3.13, Django/Oscar versions supported by the certified Ocyan foundation packages, ebaysdk 2.x, and xmltodict 0.13+. Wheel and sdist validation is artifact-only; namespace imports resolve from installed site-packages. Legacy frontend classes/templates are temporary compatibility and are not the permanent MandelBlog theme contract.

Certification preserved the existing Trading API choice (required to update manually-created listings), sync retry semantics, migrations, fixtures, and management commands. It modernized PEP 621/PEP 420 packaging, bounded certified dependencies, artifact-based Jenkins validation, and removed credential-like values from tests/fixtures. Stable release evidence is recorded in the engineering-audit repository.

API limitations and design of this plugin

The ebay api is very limited compared to what is possible with oscar. Besides that we can only do 5000 requests per day by default.

That is why i designed the following structure:

The kind of objects that have a trigger are product and stockrecord. This way we can configure individual refresh rates for product and stock records.

The reason i chose the trading api and not the more advanced rest api is because we needed to update existing listings that are created by hand which is impossible with the rest api.

if 5000 requests per day are not enough we can let ebay approve our code and increase our rate limit.

Configuration & Authentication

Before we can access te users ebay account with our application the user have te give our application consent to operate on their behalve on ebay.

Configuration

To get user consent we have to fill in the following keys and id's

These are all ocyan.json settings. By default we do requests to the sandbox, which is also an ocyan.json setting

Authentication

After we have filled in these settings the user must give their consent. Log in to the wagtail admin and go to settings -> ebay token settings

The token is valid for about a year and these steps must be repeated to renew the token.

before going further it is a good idea to also search for the return & shipping policy id's These must be entered in the ocyan.json and are send with every listing call. These can be found on the account of the ebay seller. if he does not have one he must create them.

Retreiving Existing Ebay Listings

Before retreiving existing listings we have to make sure they will not be updated directly when we are importing them. There for you must make sure the enable_sync setting in the ocyan.json is set to False, (this is the default setting)

To sync existing products i've created a listing model with an ebay_id and active status.

Existing listings always have an ebay_id we must search in our database for products that have a matching upc or title. This works very effectively for electricals but maybe in a future update we can also search voor other matching fields.

Creating A Listing.

to create a listing there are a lot of fields required.

When a product does not yet have an active listing and the ebay_sync attribute is set to True, i assume a listing with the save product must be created.

The Category detirmens which attributes are requried for the listing, when these requirements are not met the ebay listing wil not be created. The category is an model in our database and has a relation to the required specifics.

See item specifics for more information.

Item Specifics

A lot of categories in ebay have required item specifics, this is what we call product attributes in Oscar. These are detirmend by the category and are saved in a model.

These categories and specifics differ per ebay marketplace, so ebay.nl can have different categories then ebay.co.uk. These categories and specifics can be retreived with the taxonomy api.

child products require an attribute that distinguish them from each other. see parent & child products section for more information

Listing Details

is used to provide one or more product identifiers for a product, and if desired by the seller, eBay will use the identifier(s) of the product to try to match it to a defined product in the eBay catalog. If a seller's product is matched to an eBay catalog product, the product details associated with that catalog product will be prefilled for the listing. Product details defined for a catalog product include the product title, product description, product aspects, and stock image(s) of the product (if available).

Updating Listings

To update an active listing there must be an active listing in our database with an product that has the ebay_sync attribute set to True. When je save() a product all fields in ebay are updated. Attributes are only updated whene they are related to the ebay category.

You can't delete attributes because it is impossible to delete individual attributes. It is only possible to delete all attributes but some are required which still makes it impossible to delete all of them.

Delisting And Relisting

this you can do by enabling or disabling the ebay_sync attribute. When you relist a delisted listing the listing gets another ebay-id.

stock updates

These calls sit in another sync model so we can change the rate limit individually.

parent & child products

Child products are called variations in ebay, for these variations we pass the quantity and price.

Besides this we also have to indicate which attribute distinguishes the child from another child. To determine this a parent product must have the variation_specific_set attribute otherwise the listing will not be created or updated. The attributes in the varation_specific_set must exist and have a value on the child proudct. If there are more attributes together that distinguish a child you must seperate them by ; in de the variation_specific_set attribute e.g. color;size

all other attributes that are not in the variation_specific_set will be retreived from the parent product.

After the listing is created you cannot change the variation_specific_set or there corresponding values of the children. If you want to change an attribute of a child that is in variation_specific_set you must delete the child from ebay and then change it in the webshop.

Child products must always have stockrecord.

API call limit

Taxonomy API

The taxonomy api is a new rest api and for this plugin i needed to use the old trading api. On another branch called ebay_integration i've implemented the other taxonomy api. There is a managemend command that retreives all categories and specifics for the given marketplace and puts it in a json file

For EBAY_GB i've already retreived the categories and specifics, which we can use for london. theser are found in the fixtures directory

other site id's can be found here: https://developer.ebay.com/devzone/merchandising/docs/concepts/siteidtoglobalid.html

Common issues