0

I have to integrate my django project with Ebay. I have followed the SDK repository and set up an account on the developers forum as specified here Ebay SDK Repository for Python

I tried to run the following function to add an item

#!/usr/bin/env python3

from ebaysdk.trading import Connection

if __name__ == '__main__':
    api = Connection(config_file="ebay.yaml", domain="api.sandbox.ebay.com", debug=True)
    request = {
    "Item": {
        "Title": "Professional Mechanical Keyboard",
        "Country": "US",
        "Location": "IT",
        "Site": "US",
        "ConditionID": "1000",
        "PaymentMethods": "PayPal",
        "PayPalEmailAddress": "nobody@gmail.com",
        "PrimaryCategory": {"CategoryID": "33963"},
        "Description": "A really nice mechanical keyboard!",
        "ListingDuration": "Days_10",
        "StartPrice": "150",
        "Currency": "USD",
        "ReturnPolicy": {
            "ReturnsAcceptedOption": "ReturnsAccepted",
            "RefundOption": "MoneyBack",
            "ReturnsWithinOption": "Days_30",
            "Description": "If you are not satisfied, return the keyboard.",
            "ShippingCostPaidByOption": "Buyer"
        },
        "ShippingDetails": {
            "ShippingServiceOptions": {
                "FreeShipping": "True",
                "ShippingService": "USPSMedia"
            }
        },
        "DispatchTimeMax": "3"
    }
}

api.execute("AddItem", request)

but then I'm running into the following errors

ebaysdk.exception.ConnectionError: "AddItem: Class: RequestError, Severity: Error, Code: 120, You need to create a seller's account. Before you can list this item we need some additional information to create a seller's account."

020-01-16 17:13:02,385 ebaysdk [WARNING]:AddItem: Class: RequestError, Severity: Warning, Code: 21920200, Return Policy Attribute Not Valid Return Policy Attribute returnDescription Not Valid On This Site

I am not getting how to set a seller account or return policy on Ebay. I did a lot of R&D from my side but couldn't find a solution. Any help with this will be highly appreciated.

Megha Sirisilla
  • 151
  • 2
  • 12
  • Ok this is not a coding problem. Contact Ebay or read their help facilities but this question has no place here. – ggdx Jan 16 '20 at 12:00

1 Answers1

2

You have something wrong in your credentials please copy sand box credentials and if you want to generate auth token go to this url : https://developer.ebay.com/DevZone/build-test/test-tool/?index=0 and generate token and if you want to find your sand box credentials visit : https://developer.ebay.com/my/keys and if you are new user please sign up to ebay and it may take one week or 2 days to accept your account and for registration please visit : https://developer.ebay.com/signin

ebay-yaml file:

name: ebay_api_config

# Trading API Sandbox - https://www.x.com/developers/ebay/products/trading-api
api.sandbox.ebay.com:
    compatability: 719
    appid: ENTER_YOUR_APPID_HERE
    certid: ENTER_YOUR_CERTID_HERE
    devid: ENTER_YOUR_DEVID_HERE
    token: ENTER_YOUR_TOKEN_HERE

# Trading API - https://www.x.com/developers/ebay/products/trading-api
api.ebay.com:
    compatability: 719
    appid: ENTER_YOUR_APPID_HERE
    certid: ENTER_YOUR_CERTID_HERE
    devid: ENTER_YOUR_DEVID_HERE
    token: ENTER_YOUR_TOKEN_HERE

# Finding API - https://www.x.com/developers/ebay/products/finding-api
svcs.ebay.com:
    appid: ENTER_YOUR_APPID_HERE
    version: 1.0.0

# Shopping API - https://www.x.com/developers/ebay/products/shopping-api
open.api.ebay.com:
    appid: ENTER_YOUR_APPID_HERE
    version: 671

additem code:

#!/usr/bin/env python3
from ebaysdk.trading import Connection

if __name__ == '__main__':
    api = Connection(config_file="<your-yaml-file-path>", domain="api.sandbox.ebay.com", debug=True)
    request = {
        "Item": {
            "Title": "Professional Mechanical Keyboard",
            "Country": "US",
            "Location": "IT",
            "Site": "US",
            "ConditionID": "1000",
            "PaymentMethods": "PayPal",
            "PayPalEmailAddress": "nobody@gmail.com",
            "PrimaryCategory": {"CategoryID": "33963"},
            "Description": "A really nice mechanical keyboard!",
            "ListingDuration": "Days_10",
            "StartPrice": "150",
            "Currency": "USD",
            "ReturnPolicy": {
                "ReturnsAcceptedOption": "ReturnsAccepted",
                "RefundOption": "MoneyBack",
                "ReturnsWithinOption": "Days_30",
                "Description": "If you are not satisfied, return the keyboard.",
                "ShippingCostPaidByOption": "Buyer"
            },
            "ShippingDetails": {
                "ShippingServiceOptions": {
                    "FreeShipping": "True",
                    "ShippingService": "USPSMedia"
                }
            },
            "DispatchTimeMax": "3"
        }
    }
    d=api.execute("AddItem", request)
    print(d)
  • thank you for replying. I have rechecked my configurations and everything seems fine with the credentials. As I said in my question when I'm trying to run the script, the errors I'm facing are related to the insufficient data my request has, for example, the lack of seller account. If you help me on how I should set a seller account, it would be very helpful to me. – Megha Sirisilla Jan 17 '20 at 07:09
  • As you said your credentials and access token are correct then there is no need to set up seller account please test with your sand box credentials first – nagateja sharaf Feb 06 '20 at 06:48