0

New to API programming and am trying to setup eBay to call my website php script when a item is sold.

I would think this is a well document procedure but after reading up on the eBay dev site I'm even more confused. Seems to be a black art in setting this up.

I have setup my account and credentials and have that all working with a phython script to read stock levels, so I know all the dev_id, app_id, cert_id is all working.

If I understand correctly I need to to a API call to eBay to subscribe to notificationswhich I've done with:

!/usr/bin/env python3

import requests
import xml.etree.ElementTree as ET

# Set your eBay API credentials
dev_id = "MY_DEVKEY"
app_id = "MY_APPKEY"
cert_id = "MY_CERTID"
auth_token = "TOKEN"

# Set up the Trading API credentials
api_endpoint = 'https://api.ebay.com/ws/api.dll'

# Set up the request headers
headers = {
    'X-EBAY-API-COMPATIBILITY-LEVEL': '1085',
    'X-EBAY-API-DEV-NAME': dev_id,
    'X-EBAY-API-APP-NAME': app_id,
    'X-EBAY-API-CERT-NAME': cert_id,
    'X-EBAY-API-CALL-NAME': 'GetItem',
    'X-EBAY-API-SITEID': '3',
    'Content-Type': 'text/xml'
}

# Set up the request payload
payload = f"""
<?xml version="1.0" encoding="utf-8"?>
<GetNotificationPreferencesRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<ApplicationDeliveryPreferences>
    <AlertEnable>Enable</AlertEnable>
    <ApplicationEnable>Enable</ApplicationEnable>
    <ApplicationURL>http://api.mywebsite.co.uk/ebay.php</ApplicationURL>
    <DeviceType>Platform</DeviceType>
</ApplicationDeliveryPreferences>

<UserDeliveryPreferenceArray>
    <NotificationEnable>
        <EventType>ItemSold</EventType>
        <EventEnable>Enable</EventEnable>
    </NotificationEnable>
</UserDeliveryPreferenceArray>
</GetNotificationPreferencesRequest>
"""

# Send the request to the Trading API
response = requests.post(api_endpoint, headers=headers, data=payload)
print (response)


When I run this I get a 200 response back - so am I correct in assuming the subscription went in ok.

I've just sold a item and have been monitoring my web logs and not seeing any connects.

Any tips on what I'm missing, or any decent beginner links on how to set this up.

Greg
  • 1,715
  • 5
  • 27
  • 36

1 Answers1

0

I had the same issue in December 2022, and solved by requesting eBay technical support.

Below was my request to eBay technical support. The forum link is broken as eBay renewed their forum site recently. I needed purchase support hours ($75 per hour) to submit a support ticket, but it was not used for this request in my case.

According to the following developer forum page, Platform Notification doesn't work if I call SetNotificationPreferences with OAuth integration. (Not Auth’nAuth)

https://forums.developer.ebay.com/questions/26905/platform-notification-not-working.html

Someone posted that he was able to enable Platform Notification by asking eBay technical support. (please see attached screenshot) Could you please enable Platform Notification for the following App IDs?

Production: ********

enter image description here

Hope this helps.

jpsmith
  • 11,023
  • 5
  • 15
  • 36
Listman
  • 1
  • 1
  • 2