E-commerce integration with eBay API

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    847
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    451

Integration of Online Store with eBay (API)

eBay provides several APIs: Trading API (legacy), Sell API (modern REST). For new integrations, we use Sell API. Relevant for sellers working on international markets: US, UK, DE, AU.

Authentication (OAuth2)

import requests
import base64

def get_access_token(client_id: str, client_secret: str) -> str:
    credentials = base64.b64encode(f"{client_id}:{client_secret}".encode()).decode()
    resp = requests.post(
        'https://api.ebay.com/identity/v1/oauth2/token',
        headers={'Authorization': f'Basic {credentials}'},
        data={
            'grant_type': 'client_credentials',
            'scope': 'https://api.ebay.com/oauth/api_scope',
        }
    )
    return resp.json()['access_token']

Creating Listing via Inventory API

def create_inventory_item(sku: str, product: dict, token: str) -> None:
    headers = {'Authorization': f'Bearer {token}', 'Content-Language': 'de-DE'}

    # Creating inventory item
    requests.put(
        f'https://api.ebay.com/sell/inventory/v1/inventory_item/{sku}',
        headers=headers,
        json={
            'availability': {'shipToLocationAvailability': {'quantity': product['stock']}},
            'condition':    'NEW',
            'product': {
                'title':        product['name'],
                'description':  product['description'],
                'imageUrls':    product['images'],
                'aspects': {'Brand': [product['brand']]},
                'ean':          [product['ean']],
            },
        }
    )

    # Creating offer (listing)
    requests.post(
        'https://api.ebay.com/sell/inventory/v1/offer',
        headers=headers,
        json={
            'sku':         sku,
            'marketplaceId': 'EBAY_DE',
            'format':      'FIXED_PRICE',
            'pricingSummary': {
                'price': {'value': str(product['price']), 'currency': 'EUR'}
            },
            'fulfillmentPolicyId': FULFILLMENT_POLICY_ID,
            'paymentPolicyId':     PAYMENT_POLICY_ID,
            'returnPolicyId':      RETURN_POLICY_ID,
            'merchantLocationKey': WAREHOUSE_KEY,
            'categoryId':          product['ebay_category_id'],
        }
    )

Getting Orders

def get_orders(token: str, since: str) -> list:
    resp = requests.get(
        'https://api.ebay.com/sell/fulfillment/v1/order',
        headers={'Authorization': f'Bearer {token}'},
        params={'filter': f'creationdate:[{since}..{datetime.utcnow().isoformat()}Z]', 'limit': 50}
    )
    return resp.json().get('orders', [])

eBay Notifications

// eBay Platform Notifications handler
Route::post('/webhooks/ebay', function (Request $request) {
    // eBay sends XML notifications
    $xml = simplexml_load_string($request->getContent());
    $eventType = (string) $xml->BuyerUserID;  // depends on notification type
    // ... processing
    return response('');
});

Timeline

Registration in eBay Developer Program: 1–3 days. Integration (listings + orders): 14–20 business days.